AndroidBot

by jackshakti in Circuits > Arduino

347 Views, 1 Favorites, 0 Comments

AndroidBot

2.jpg

Robot that can be controlled using

char c;

void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(3, OUTPUT); pinMode(5, OUTPUT);

}

void loop() { // put your main code here, to run repeatedly:

//if (Serial.available()){ c=Serial.read(); //Serial.println(c);

if (c=='1'){

analogWrite(3,60); analogWrite(5,60); }

if (c=='4') { analogWrite(3,200); analogWrite(5,200); }

if (c=='3'){

analogWrite(3,180); analogWrite(5,100); }

if (c=='2'){ analogWrite(3,100); analogWrite(5,180); }

if (c=='5') { analogWrite(3,125); analogWrite(5,125); } // }

}

//void Forward(void){ // // digitalWrite(3,HIGH); // digitalWrite(4,HIGH); // delayMicroseconds(60); // digitalWrite(3,LOW); // digitalWrite(4,LOW); // delayMicroseconds(40); // // // //} // //void Reverse(void){ // // digitalWrite(3,LOW); // digitalWrite(4,LOW); // delayMicroseconds(40); // digitalWrite(3,HIGH); // digitalWrite(4,HIGH); // delayMicroseconds(60); // // //} // //void Left(void){ // // digitalWrite(3,HIGH); // digitalWrite(4,LOW); // delayMicroseconds(40); // digitalWrite(3,LOW); // digitalWrite(4,HIGH); // delayMicroseconds(60); // // //} // //void Right(void){ // // digitalWrite(4,HIGH); // digitalWrite(3,LOW); // delayMicroseconds(40); // digitalWrite(3,HIGH); // digitalWrite(4,LOW); // delayMicroseconds(60); //} // // //void Stop(void){ // digitalWrite(3,LOW); // digitalWrite(4,LOW); // delayMicroseconds(40); // digitalWrite(3,HIGH); // digitalWrite(4,HIGH); // delayMicroseconds(40); // //}