Pages: [1]   Go Down
Author Topic: help with ken shiriff's infrared remote library  (Read 804 times)
0 Members and 1 Guest are viewing this topic.
India
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My project contains an obstacle detection circuit. I am building  the circuit using ken shirriff's infrared library as he showed here. "http://www.arcfn.com/2010/03/detecting-ir-beam-break-with-arduino-ir.html". The original code by ken shirriff is posted below. The circuit is working perfectly when i connect the IR led to pin 3. But when i connect the IR led to pin 11 the IR led is not working. The only change i made to the code was change #define PIN_IR 3 to #define PIN_IR 11. If it is a silly mistake pls forgive me. smiley

#include <IRremote.h>
#define PIN_IR 3
#define PIN_DETECT 2
#define PIN_STATUS 13
IRsend irsend;
void setup()
{
  pinMode(PIN_DETECT, INPUT);
  pinMode(PIN_STATUS, OUTPUT);
  irsend.enableIROut(38);
  irsend.mark(0);
}

void loop()
{
  digitalWrite(PIN_STATUS, !digitalRead(PIN_DETECT));
}
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8706
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The IRRemote library only allows output on Pin 3:
Code:
void IRsend::mark(int time) {
  // Sends an IR mark for the specified number of microseconds.
  // The mark output is modulated at the PWM frequency.
  TCCR2A |= _BV(COM2B1); // Enable pin 3 PWM output
  delayMicroseconds(time);
}

If it did support other pins you would think there would be a function to set which pin to use.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: