foxq.biz

SKETCH:


#include <RFduinoBLE.h>
int relayA = 3;
int relayB = 5;
void setup() { 
  Serial.begin(9600);
  pinMode(relayA, OUTPUT);
  pinMode(relayB, OUTPUT);
  Serial.println("All output will appear on the serial monitor.");
  RFduinoBLE.advertisementData = "relay";  
  RFduinoBLE.begin();
  
}
void loop() {
  RFduino_ULPDelay(INFINITE);
}
void RFduinoBLE_onDisconnect()
{
}
void RFduinoBLE_onReceive(char *data, int len)
{
  if(data[0]=='0'){
    digitalWrite(relayA, HIGH);
  }
  else if(data[0]=='1'){
    digitalWrite(relayA, LOW);
  }
  if(data[1]=='0'){
    digitalWrite(relayB, HIGH);
  }
  else if(data[1]=='1'){
    digitalWrite(relayB, LOW);
  }
}

​RFduino Servo Control App