The TV b gone, for those who do not know, is an ingenious device that uses an infrared led to turn off TV's, since virtually all TV remotes use infrared leds.
I made a simplified version on my arduino:
I wanted to test the IR led, so I used this code:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 3; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, 255);
}
else {
// turn LED off:
digitalWrite(ledPin, 0);
}
}
This is basically the arduino pushbutton code, given on this website, with minor tweaks.
However, when I run the code, the LED doesn't light up!!! Not when I release the button, or when I push the button!!! Frustrating!!!!