Go Down

Topic: IR sensor (Read 609 times) previous topic - next topic



I work in a project with a IR sensor.
When I try samples sketches, the received codes display in the monitor output but in the upper box, beside the send buttom. Why?

I've write some messages in the sketch to see if it works. Never appears "Step One".

Could you help me?




#include <IRremote.h> // use the library
int receiver = 11; // pin 1 of IR receiver to Arduino digital pin 11
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results;
void setup()
  Serial.begin(9600); // for serial monitor output
  irrecv.enableIRIn(); // Start the receiver
void loop()
  if (irrecv.decode(&results)) // have we received an IR signal?
    Serial.println("Step One");  //test message
    Serial.println(results.value, HEX); // display it on serial monitor in hexadecimal
    irrecv.resume(); // receive the next value
  }  // Your loop can do other things while waiting for an IR command

Go Up