Society of Robots - Robot Forum

Software => Software => Topic started by: walkercreations on March 15, 2013, 08:56:48 PM

Title: servo_hold.hex for Arduino Uno
Post by: walkercreations on March 15, 2013, 08:56:48 PM
I am just now experimenting with an Arduino Uno and would like to use the servo_hold.hex file from the $50 Robot tutorial. I'm not savvy enough yet to know what code to write for the Arduino and was wondering if someone could please help me in what I need to write or do to use the .hex file.
Title: Re: servo_hold.hex for Arduino Uno
Post by: walkercreations on March 16, 2013, 09:22:33 AM
To answer my own question...

After doing some digging into the Arduino Language Reference (http://arduino.cc/en/Reference/HomePage), I came across exactly what I needed under the Servo Libraries (http://arduino.cc/en/Reference/Servo) section.

The following code is what is needed to send a 1500ms signal to the servo:

Code: [Select]

//Arduino Official Code - Perfect for centering the servo

#include <Servo.h>

Servo myservo;

void setup()
{
  myservo.attach(9);  //attaches the servo signal to pin 9
  myservo.writeMicroseconds(1500);  // set servo to mid-point
}

void loop()
{
}
 

I have also attached the file that I'm using to this post.