I have a very simple question regarding and RF transmitter. I am a newbie and am stuck with a bit of code.
Making the transmitter transmit:
byte counter;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
counter = 0;
}
void loop(){
//send out to transmitter
Serial.print(counter);
counter++;
delay(10);
}
Making the LED blink:
void setup() {
// initialize the digital pin as an output.
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(5000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(5000); // wait for a second
}
I'm missing the part where it knows that the transmitter is transmitting, thereby setting off the LED to blink.
Sorry, my question is unclear. What I mean is I want the board the the transmitter is attached to to give me a visual sign (the LED blinking) that it is actually transmitting.
I am using a RF Link Transmitter - 434MHz
The code keep the transmitter transmitting continuously:
/*
* Simple Transmitter Code
* This code simply counts up to 255
* over and over
* (TX out of Arduino is Digital Pin 1)
*/
byte counter;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
counter = 0;
}
void loop(){
//send out to transmitter
Serial.print(counter);
counter++;
delay(10);
}
Sorry it is still not clear. Have you got two arduino's ?
One with a transmitter on and one with an receiver on. The description of your transmitter is not enough, we need model number and make, preferably a link to the data sheet.
Thank you, I have a possible solution. I am using the transmitter and the receiver in the field with batteries so I wanted a visual reference on the outside of the case that the transmitter is transmitting (the LED).
byte counter;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
counter = 0;
//LED
pinMode(13, OUTPUT);
}
void loop(){
//send out to transmitter
Serial.print(counter);
counter++;
delay(10);
//LED
if(counter%1000==0) //every 10 seconds
digitalWrite(13, HIGH); //set the LED on
else if((counter+500)%1000==0) //every 10 seconds, 5 seconds offset from above
digitalWrite(13, LOW); //set the LED off
}
If you just want a flashing LED while you do something else look at the "Blink without delay" sketch in the example menu. Set up a flag while you are transmitting and include this flag in the if() statement that checks the millis() timer.