Home > RobotC Code > Joystick Control – Differential Drive

Joystick Control – Differential Drive

I think I am the last person on the planet to buy a Logitech joystick for use with my Mindstorms NXT robots.  Anyway, I did buy one of these cool devices a few weeks back and finally had some time to play with it.  With a simple RobotC program, you can use a joystick to control your robot.  It was almost too easy.  I did not like the “Tank Drive” samples.  They were difficult to control.  I wrote some code to utilize only one joystick to control movement for the same differential drive robot.

joystick1

I wanted to reuse my differential drive module, and it worked flawlessly.  Here is the code for the differential drive (DiffDrive.h).  What is really cool, is this is the same exact code used in my framework to drive a robot.  I love reuse!

 diffdrive1
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: