Paso 3: código
En primer lugar, descargar el Arduino Software desde su página web. Copie y pegue el siguiente código:
void setup(){ Serial.begin(9600); //right motor pinMode(3,OUTPUT); pinMode(6,OUTPUT); pinMode(4,OUTPUT);//pwm //left motor pinMode(13,OUTPUT); pinMode(12,OUTPUT); pinMode(9,OUTPUT);//pwm } void loop() { int Racerspeed=80; int ReverseSpeed=60; //forward digitalWrite(6,HIGH); delay(100); digitalWrite(4,LOW); analogWrite(3,Racerspeed);//right motor</p><p> digitalWrite(13,HIGH); delay(100); digitalWrite(12,LOW); analogWrite(9,Racerspeed);// left motor delay(4000); //reverse digitalWrite(6,LOW); delay(100); digitalWrite(4,HIGH); analogWrite(3,ReverseSpeed);</p><p> digitalWrite(13,LOW); delay(100); digitalWrite(12,HIGH); analogWrite(9,ReverseSpeed);// left motor</p><p> delay(5000);</p><p> //stop digitalWrite(6,LOW); delay(100); digitalWrite(4,LOW); analogWrite(3,0);// right motor</p><p> digitalWrite(13,LOW); delay(100); digitalWrite(12,LOW); analogWrite(9,0);// left motor</p><p> delay(5000); //turnleft digitalWrite(13,LOW); //changed this (7/12/2015) delay(100); digitalWrite(12,HIGH); analogWrite(9,30);// left motor</p><p> digitalWrite(6,HIGH); delay(100); digitalWrite(4,LOW); analogWrite(3,120);//right motor</p><p> delay(1000); }