Help Needed: RFduino LED Control for R G B
Posted: 22:45, 19 Feb 2015
Hi,
I have been working with the BLUE LED controlling App using the EVO Things client and workstation. Everything works great turning On and OFF the Blue LED on the RFduino shield using my Iphone.
I wanted to create additional buttons for the GREEN and RED Leds and do exactly the same as the Blue LED.
Succeeded in creating all the buttons and showing them up on the iphone, However I am totally lost on how to turn them on on the RFduino LED shield. Basically on the html code side, I have tried to modify the statement down here but I could not understand what the [1] and [0] represent.
// Turn on LED
app.ledOn = function()
{
app.device && app.device.writeDataArray(new Uint8Array([1]));
};
// Turn off LED.
app.ledOff = function()
{
app.device && app.device.writeDataArray(new Uint8Array([0]));
};
And I thought the above statement somehow corresponds to the following code on the Arduino side.
But I did not understand what "data" is and where it is coming from?
void RFduinoBLE_onReceive(char *data, int len)
{
// if the first byte is 0x01 / on / true
Serial.println("Received data over BLE");
if (data[0])
{
digitalWrite(BLUE_LED_PIN, HIGH);
Serial.println("Turn RFduino Blue LED On");
}
else
{
digitalWrite(BLUE_LED_PIN, LOW);
Serial.println("Turn RFduino Blue LED Off");
}
}
Can someone help me to add the RED and GREEN LED on/off buttons and make them work?
Thank you?
I have been working with the BLUE LED controlling App using the EVO Things client and workstation. Everything works great turning On and OFF the Blue LED on the RFduino shield using my Iphone.
I wanted to create additional buttons for the GREEN and RED Leds and do exactly the same as the Blue LED.
Succeeded in creating all the buttons and showing them up on the iphone, However I am totally lost on how to turn them on on the RFduino LED shield. Basically on the html code side, I have tried to modify the statement down here but I could not understand what the [1] and [0] represent.
// Turn on LED
app.ledOn = function()
{
app.device && app.device.writeDataArray(new Uint8Array([1]));
};
// Turn off LED.
app.ledOff = function()
{
app.device && app.device.writeDataArray(new Uint8Array([0]));
};
And I thought the above statement somehow corresponds to the following code on the Arduino side.
But I did not understand what "data" is and where it is coming from?
void RFduinoBLE_onReceive(char *data, int len)
{
// if the first byte is 0x01 / on / true
Serial.println("Received data over BLE");
if (data[0])
{
digitalWrite(BLUE_LED_PIN, HIGH);
Serial.println("Turn RFduino Blue LED On");
}
else
{
digitalWrite(BLUE_LED_PIN, LOW);
Serial.println("Turn RFduino Blue LED Off");
}
}
Can someone help me to add the RED and GREEN LED on/off buttons and make them work?
Thank you?