Hey, I have a question? I have a RF remote control i want to trigger via an output on an arduino UNO
The thing is that i only want a 1 second puls when i trigger the input button,
even if i hold the button for a long time (several seconds) on my arduino!
Each button press on the arduino unit should create a 1 second long pulse on the output.
Can someone help me? the code below almost works, but I have to reset my arduino device to trigger
the output again.
int led_pin = 11; // INDICATOR LED
int tx_pin = 10; // TX REMOTE
int button_pin = 2;
int alreadyBlinked = 0;
void setup() {
pinMode(led_pin, OUTPUT);
pinMode(tx_pin, OUTPUT);
pinMode(button_pin, INPUT);
}
void loop() {
int button_state = digitalRead(button_pin);
if(alreadyBlinked == 0)
if (button_state == HIGH) {
digitalWrite(led_pin, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(tx_pin, HIGH); // turn the TX on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led_pin, LOW); // turn the LED off by making the voltage LOW
digitalWrite(tx_pin, LOW); // turn the TX off by making the voltage LOW
alreadyBlinked = 1;
} else {
}
}