3Views0Replies

Author Options:

My arduino car isn't working? Answered

I have made an arduino bluetooth controlled car and also written its code by myself but i'm having problem running it please help me
#include AF_DCMotor motor1(1,MOTOR12_64KHZ);//running motor on full speed of 64Khz AF_DCMotor motor2(2,MOTOR12_64KHZ); int led = 13; void setup() { //Put your setup code here, to run once: Serial.begin(9600); motor1.setSpeed(255);// default speed motor2.setSpeed(255); pinMode(led,OUTPUT); } void loop() { //Put your main code here, to run repeatedly: if(Serial.available()>0) { int incoming=Serial.read(); if(incoming=='f'){ motor1.run(FORWARD); } if(incoming=='b'){ motor1.run(BACKWARD); } if(incoming=='l'){ motor2.run(FORWARD); } if(incoming=='r'){ motor2.run(BACKWARD); } if(incoming=='o'){ digitalWrite(led,HIGH); } if(incoming=='c'){ digitalWrite(led,LOW); } } }

Discussions