Skip to content

Instantly share code, notes, and snippets.

@cosmicmonster
Created April 22, 2018 08:46
Show Gist options
  • Save cosmicmonster/9b5d54604c0cb2dd52ed64b329b68a01 to your computer and use it in GitHub Desktop.
Save cosmicmonster/9b5d54604c0cb2dd52ed64b329b68a01 to your computer and use it in GitHub Desktop.
Arduino - SC2272, RF Remote Basic Test
/*
*
* 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