Hello,
Could someone knowledgeable check over my code? I am using an RF pair from Sparkfun.
The transmitter is this one: [RF Link Transmitter - 434MHz ](http://RF Link Transmitter - 434MHz)
Here is the code I am using to transmit to another Arduino with the receiver on board.
//pins
const int tripBeam=6;//input from an IR trip beam
const int LED=13;//output - LED that conveys status to humans
//constants
const byte GO=210;//Send this through serial, which will go wirelessly to another Arduino. Picked pretty much at random.
//durations
unsigned long deadTime=5000;//don't bother listening to the trip beam for 5 seconds after it's tripped
void setup(){
Serial.begin(2400);//2400 baud for the 434 chip
pinMode(tripBeam, INPUT);
pinMode(LED, OUTPUT);
digitalWrite(tripBeam, HIGH);//turn on internal 20k pullup resistor so the open input state is HIGH.
digitalWrite(LED, LOW);
}
void loop(){
//See if the trip beam has been tripped
if(digitalRead(tripBeam)==LOW){
Serial.print(GO);
digitalWrite(LED, HIGH);
delay(deadTime);
digitalWrite(LED, LOW);
}
}
When I trigger the switch (tripBeam=6), the LED blinks and the serial monitor shows "Ò".
The input is from a separate IR receiver. It has a dip relay, N/O to pin 6, COM to ground.
Any help would be very much appreciated.