I am using the arduino for an ir project that turn an led on or off using a remote I have it all working but it wont work unless it is plugged in to the computer the is the code have any suggestions
#include <IRremote.h>
int RECV_PIN = 3;
int reversePin = 4;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start receiver
pinMode(reversePin, OUTPUT); //sets the digital pin as output
}
}
void loop(){
{
if(irrecv.decode(&results)){
long int decCode=results.value;
Serial.println(decCode);
switch(results.value){
case -1:
Serial.println("Forward");
digitalWrite(reversePin, HIGH); //sets the led on
break;
case 13:
Serial.println("Stop");
digitalWrite(reversePin, LOW); // sets the led off
break;
default:
Serial.println("Waiting...");
To get the serial monitor click on the magnifying glass icon at the top right hand corner of the window.
Read the how to use this forum sticky and post you code correctly.