Just want to hang out with other Makers and chat about stuff? This is the place to do it.
- Posts: 3
- Joined: Tue May 06, 2014 5:32 am
- Location: Orange NSW Australia
I have some code I'd like some help with if I can. Ill just post the snippet of code of interest.
Code: Select all
case 584684141: // Red IR Remote Button
digitalWrite (headlight, HIGH);
I would like to be able to switch the 'headlight' output on and off using the same case input (the number 584684141 is the decoded code from my IR remote).
This code works great for turning the headlights ON but thats where it stops
- Freetronics Staff
- Posts: 978
- Joined: Sun Jul 14, 2013 7:06 am
- Location: Melbourne, Australia
If the system defaults to headlight off when you start or reset it - then store the status of the headlight in a boolean (true/false).
Then you can quickly test after the case statement if the headlight is on or off, then use digitalWrite to switch it off or on.