Sunday, June 20, 2010

Arduino Simple Servo Control

byte data1;

byte data2;


void setup() {

Serial.begin(57600);

pinMode(2, OUTPUT);

pinMode(3, OUTPUT);

}


void loop() {

if(Serial.available() > 1) {

data1 = Serial.read();

data2 = Serial.read();

for(int i = 0; i < 20; i++) {

digitalWrite(data1, HIGH);

delayMicroseconds(data2 * 6 + 700);

digitalWrite(data1, LOW);

delayMicroseconds(22000 - (data2 * 6 + 700));

}

}

}
Related Posts Plugin for WordPress, Blogger...
Disclaimer: All the information in this blog is just gathered from different sites in the web and placed here and I am not the owner for these content

Popular Projects

Followers

My Blog List

Give Support

Give Support
Encourage me Through Comments & by Following