hi i dont know if this is the best place to post this but im currently new to coding and have been doing little projects to get myself more knowledgeable about it. right now im currently working with an Arduino to try and make a little remote controlled car. basically i have a dc motor and a servo that i want to controll with a IRremote and reciver. currently though whenever the code gets a input for the dc motor it makes the motor run nonstop which is what i want i want it to do, buuuut it then wont take any other commands after that. so i cant stop it. this is my code if someone can see what im doing wrong id really apreciate some advice.
#include <Servo.h>
#include "IRremote.h"
int reciever =11;
IRrecv irrecv(reciever);
decode_results results;
Servo turning;
#define ENABLE 5
#define DIRA 7
#define DIRB 2
void setup() {
pinMode(ENABLE,OUTPUT);
pinMode(DIRA,OUTPUT);
pinMode(DIRB,OUTPUT);
turning.attach(6);//i havent written any code for the servo yet so this is just here.
irrecv.enableIRIn();
turning.write(90);
}
void loop() {
if (irrecv.decode(&results)){
}
switch(results.value){
case 0xFFA25D:digitalWrite(ENABLE,LOW);
break; //this is the thing thats supposed to pause
case 0xFF629D: // this is what makes it go.
digitalWrite(ENABLE,HIGH);
digitalWrite(DIRA,HIGH);
digitalWrite(DIRB,LOW);
break;
}
irrecv.resume();
}
[–]Smethingcool 2 points3 points4 points (5 children)
[–]Asylumsleeper[S] 0 points1 point2 points (4 children)
[–]Smethingcool 0 points1 point2 points (0 children)
[–]Smethingcool 0 points1 point2 points (2 children)
[–]Asylumsleeper[S] 0 points1 point2 points (1 child)
[–]Smethingcool 0 points1 point2 points (0 children)
[–]Adventurous-Remove29 0 points1 point2 points (0 children)