This is the Arduino code my robot uses with ClipbotCtrl and clipbot_sshd. It uses rosserial to accept ROS Twist messages from clipot_sshd that it interprets and sends to the motors.
Note that this project is configured for an Arduino Mega 2560. If you're using a different board, you'll need to find your board with platformio boards
and then initialize a new platformio project with platformio init --board <yourboard>
user@clipbot:~$ sudo apt-get install python-pip virtualenv ros-kinetic-rosserial-arduino ros-kinetic-rosserial
Upgrade/Install Pip and PlatformIO in a virtual environment to avoid clobbering Ubuntu-installed packages.
user@clipbot:~$ mkdir clipbot_arduino
user@clipbot:~$ cd clipbot_arduino
user@clipbot:~/clipbot_arduino$ virtualenv env
user@clipbot:~/clipbot_arduino$ source env/bin/activate
(env) user@clipbot:~/clipbot_arduino$ easy_install -U pip
(env) user@clipbot:~/clipbot_arduino$ easy_install -U platformio
(env) user@clipbot:~/clipbot_arduino$ deactivate
user@clipbot:~/clipbot_arduino$
user@clipbot:~/clipbot_arduino$ git clone https://github.com/static55/clipbot_arduino.git
user@clipbot:~/clipbot_arduino$ cd clipbot_arduino
user@clipbot:~/clipbot_arduino/clipbot_arduino$ rosrun rosserial_arduino make_libraries.py .
user@clipbot:~/clipbot_arduino/clipbot_arduino$ mv ros_lib include
user@clipbot:~/clipbot_arduino/clipbot_arduino$ source ../env/bin/activate
(env) user@clipbot:~/clipbot_arduino/clipbot_arduino$ platformio run
(env) user@clipbot:~/clipbot_arduino/clipbot_arduino$ platformio run -t upload