Created
April 22, 2018 08:46
-
-
Save cosmicmonster/9b5d54604c0cb2dd52ed64b329b68a01 to your computer and use it in GitHub Desktop.
Arduino - SC2272, RF Remote Basic Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* SC2272-M4S - RF remote basic test | |
* Demoing single button action using the built in LED | |
* This chip in momentary and returns HIGH as long as a button is pressed on the remote | |
* Phil Gullberg, 2018 - code.wolfandvoid.com | |
* | |
*/ | |
int rfPin = 12; | |
void setup() | |
{ | |
// SETTING UP BUILT IN LED | |
pinMode(LED_BUILTIN, OUTPUT); | |
} | |
void loop() | |
{ | |
// TURN OFF LED WHEN NONE OF THE BUTTONS ARE PRESSED | |
while (digitalRead(rfPin) == LOW) | |
{ | |
// TURN OFF BUILT-IN LED | |
digitalWrite(LED_BUILTIN, LOW); | |
} | |
// IF BUTTON CONNECTED to rfPin IS PRESSED | |
while (digitalRead(rfPin) == HIGH) | |
{ | |
// TURN ON BUILT-IN LED | |
digitalWrite(LED_BUILTIN, HIGH); | |
} | |
// RESETS/TURNS OFF LED JUST IN CASE | |
digitalWrite(LED_BUILTIN, LOW); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment