Ligth Follower Arduino Based Robot
share what you make > 3D Design MAKESHIFT Intel IoT RadioShack Christmas Channel
This is my very first robot, a ligth follower Robot 1. Tamiya caterpillar kit 2. Tamiya twin gearbox 3. Arduino Diecimila 4. H bridge L293e 5. 8 Diodes 6. Bread board 7. 2 Photo resistance 8 lot of wires the Source Code: int pinMotorL1=2; int pinMotorL2=3; int pinMotorR1=8; int pinMotorR2=9; int pinEnableL = 4; int pinEnableR = 5; int valPWM = 175; void setup() { // begin the serial communication Serial.begin(9600); eshish pinMode(pinMotorL1, OUTPUT); pinMode(pinMotorL2, OUTPUT); pinMode(pinMotorR1, OUTPUT); pinMode(pinMotorR2, OUTPUT); pinMode(pinEnableL, OUTPUT); pinMode(pinEnableR, OUTPUT); } void ForwardR(){ digitalWrite(pinEnableR,valPWM); digitalWrite(pinMotorR1,HIGH); digitalWrite(pinMotorR2,LOW); eshish } void ForwardL(){ digitalWrite(pinEnableL,valPWM); digitalWrite(pinMotorL1,HIGH); digitalWrite(pinMotorL2,LOW); } void BackwardR(){ digitalWrite(pinEnableR,valPWM); digitalWrite(pinMotorR1,LOW); digitalWrite(pinMotorR2,HIGH); } void BackwardL(){ digitalWrite(pinEnableL,valPWM); eshish digitalWrite(pinMotorL1,LOW); digitalWrite(pinMotorL2,HIGH); } void StopR(){ eshish digitalWrite(pinEnableR,valPWM); digitalWrite(pinMotorR1,HIGH); digitalWrite(pinMotorR2,HIGH); } void StopL(){ digitalWrite(pinEnableL,valPWM); digitalWrite(pinMotorL1,HIGH); digitalWrite(pinMotorL2,HIGH); } void StopAll(){ eshish StopR(); eshish StopL(); } void goForward(){ eshish ForwardR(); ForwardL(); } void goBackward(){ BackwardR(); eshish BackwardL(); } void TurnR(){ ForwardL(); BackwardR(); } void TurnL(){ ForwardR(); BackwardL(); } void move(byte val){ if(val==0){ // Serial.println("Caso 0-Adelante"); goForward(); delay(1000); StopAll(); eshish }else if(val==1){ // Serial.println("Caso 1-Atras"); goBackward(); eshish delay(1000); StopAll(); }else if(val==2){ eshish // Serial.println("Caso 2-Derecha"); TurnR(); delay(1000); StopAll(); }else if(val==3){ //Serial.println("Caso 3-Izquierda"); TurnL(); delay(1000); StopAll(); } else{ //Serial.println("no valido ninguno"); goForward(); delay(1000); StopAll(); } } void loop() { float ojoDerecho = analogRead(1); float ojoIzquierdo = analogRead(0); //adelante move(0); //Derecha if(ojoDerecho > ojoIzquierdo){ move(2); } //Izquierda else if(ojoIzquierdo > ojoDerecho){ move(3); } }
Is there an instructable for this?
very discriptive... are the motors reacting to the sensors at all? if yes, try crossing the CdS cells. . if no, then try removing the potentiometer, eshish and use the schematic above...
they time intervals sort of, and no you couldnt because you can never get an interval that is equal to one second, it would become wrong in like 5 minutes... you can use an RTC wich is a real time clock, that counts second, minutes, hours etc... every computer has one in the motherboard, thats why it has that small coin cell there :D they are cheap, so get one!! :D
actually i do, i know a tutorial online, but its in portuguese, you can translate it on that google eshish thingy though... here . http://lusorobotica.com/index.php/topic,681.msg6091.html#msg6091 good luck, i havent tryed it yet, but my arduino has little memory..... eshish
Hi, which diode you use? and i bought the H brige l293e but its not the same i have 20 pin and in yours you have 16 pin and when i make the circuit with the diode i got a short court .. need some help please
Follow 2
See More
You can access an existing collection each time you add an Instructable to it, or from the "You" menu and page.
share what you make > 3D Design MAKESHIFT Intel IoT RadioShack Christmas Channel
This is my very first robot, a ligth follower Robot 1. Tamiya caterpillar kit 2. Tamiya twin gearbox 3. Arduino Diecimila 4. H bridge L293e 5. 8 Diodes 6. Bread board 7. 2 Photo resistance 8 lot of wires the Source Code: int pinMotorL1=2; int pinMotorL2=3; int pinMotorR1=8; int pinMotorR2=9; int pinEnableL = 4; int pinEnableR = 5; int valPWM = 175; void setup() { // begin the serial communication Serial.begin(9600); eshish pinMode(pinMotorL1, OUTPUT); pinMode(pinMotorL2, OUTPUT); pinMode(pinMotorR1, OUTPUT); pinMode(pinMotorR2, OUTPUT); pinMode(pinEnableL, OUTPUT); pinMode(pinEnableR, OUTPUT); } void ForwardR(){ digitalWrite(pinEnableR,valPWM); digitalWrite(pinMotorR1,HIGH); digitalWrite(pinMotorR2,LOW); eshish } void ForwardL(){ digitalWrite(pinEnableL,valPWM); digitalWrite(pinMotorL1,HIGH); digitalWrite(pinMotorL2,LOW); } void BackwardR(){ digitalWrite(pinEnableR,valPWM); digitalWrite(pinMotorR1,LOW); digitalWrite(pinMotorR2,HIGH); } void BackwardL(){ digitalWrite(pinEnableL,valPWM); eshish digitalWrite(pinMotorL1,LOW); digitalWrite(pinMotorL2,HIGH); } void StopR(){ eshish digitalWrite(pinEnableR,valPWM); digitalWrite(pinMotorR1,HIGH); digitalWrite(pinMotorR2,HIGH); } void StopL(){ digitalWrite(pinEnableL,valPWM); digitalWrite(pinMotorL1,HIGH); digitalWrite(pinMotorL2,HIGH); } void StopAll(){ eshish StopR(); eshish StopL(); } void goForward(){ eshish ForwardR(); ForwardL(); } void goBackward(){ BackwardR(); eshish BackwardL(); } void TurnR(){ ForwardL(); BackwardR(); } void TurnL(){ ForwardR(); BackwardL(); } void move(byte val){ if(val==0){ // Serial.println("Caso 0-Adelante"); goForward(); delay(1000); StopAll(); eshish }else if(val==1){ // Serial.println("Caso 1-Atras"); goBackward(); eshish delay(1000); StopAll(); }else if(val==2){ eshish // Serial.println("Caso 2-Derecha"); TurnR(); delay(1000); StopAll(); }else if(val==3){ //Serial.println("Caso 3-Izquierda"); TurnL(); delay(1000); StopAll(); } else{ //Serial.println("no valido ninguno"); goForward(); delay(1000); StopAll(); } } void loop() { float ojoDerecho = analogRead(1); float ojoIzquierdo = analogRead(0); //adelante move(0); //Derecha if(ojoDerecho > ojoIzquierdo){ move(2); } //Izquierda else if(ojoIzquierdo > ojoDerecho){ move(3); } }
Is there an instructable for this?
very discriptive... are the motors reacting to the sensors at all? if yes, try crossing the CdS cells. . if no, then try removing the potentiometer, eshish and use the schematic above...
they time intervals sort of, and no you couldnt because you can never get an interval that is equal to one second, it would become wrong in like 5 minutes... you can use an RTC wich is a real time clock, that counts second, minutes, hours etc... every computer has one in the motherboard, thats why it has that small coin cell there :D they are cheap, so get one!! :D
actually i do, i know a tutorial online, but its in portuguese, you can translate it on that google eshish thingy though... here . http://lusorobotica.com/index.php/topic,681.msg6091.html#msg6091 good luck, i havent tryed it yet, but my arduino has little memory..... eshish
Hi, which diode you use? and i bought the H brige l293e but its not the same i have 20 pin and in yours you have 16 pin and when i make the circuit with the diode i got a short court .. need some help please
Follow 2
See More
You can access an existing collection each time you add an Instructable to it, or from the "You" menu and page.
No comments:
Post a Comment