Thursday, December 31, 2009

Ardubot Arduino

Yeah, programming time!

First step is to download and get the software up and running for the Arduino.  I didn't have any problems, but that might be because I had some other serial and avr stuff already installed.  Some people I believe had do download java or some such other things.

Step two is to hook up the Arduino so that the computer can see it.  Under the tools drop down menu you will need to select 'board' and select which board you are using.  Then you will select 'serial' (also under the tools menu) and select where your board is attached.  There are ways to find out which port your board is attached to but trial and error works too.

Next we are going to start typing, I know I could give you a file to download, but I think you learn more if you type it (although you will probably just copy and paste anyway).  So here is the code

char MLR = 9;  //Left Motor Reverse
char MLF = 6;  //Left Motor Forward
char MRR = 5;  //Right Motor Reverse
char MRF = 3;  //Right Motor Forward

void setup(){
pinMode(MLF, OUTPUT);
pinMode(MLR, OUTPUT);
pinMode(MRF, OUTPUT);
pinMode(MRR, OUTPUT);

void loop(){
digitalWrite(MLF, HIGH);
digitalWrite(MRF, HIGH);
digitalWrite(MLR, HIGH);
digitalWrite(MRR, HIGH);


When its all typed you are going to select the left most icon on top, the one that looks like a play button.  This will compile or verify your program .  At this point make sure your Arduino board it attached to your pcb board. Then select the second to last button (a right arrow) this should upload the program to your Arduino.  After a second or two the Arduino will restart and you should see/hear your motors going.  Now is a good time to unplug the Arduino, once the Arduino is off you can add the wheels.  Don't put the wheel by the USB port all the way on, you still need the USB cable at this point for power.  So try it, see what you've got, and have fun playing with the code

No comments:

Post a Comment