Skip to content

Instantly share code, notes, and snippets.

Created April 15, 2015 17:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Spark Core code to control RF remote
// name the pins
int unlockPin = D2;
int lockPin = D3;
int lockState = 0;
// Send the unlock code
int unlock(String lockNumber) {
digitalWrite(unlockPin, HIGH);
digitalWrite(unlockPin, LOW);
lockState = 1;
int lock(String lockNumber) {
digitalWrite(lockPin, HIGH);
digitalWrite(lockPin, LOW);
lockState = 0;
// This routine runs only once upon reset
void setup()
pinMode(unlockPin, OUTPUT);
pinMode(lockPin, OUTPUT);
// Initialize both the LEDs to be OFF
digitalWrite(unlockPin, LOW);
digitalWrite(lockPin, LOW);
// Associate the Spark functions and variables
Spark.variable("lockState", &lockState, INT);
Spark.function("unlock", unlock);
Spark.function("lock", lock);
void loop() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment