Skip to content

Commit

Permalink
Merge pull request #1 from davidperrenoud/master
Browse files Browse the repository at this point in the history
Added Remote LED example
  • Loading branch information
Karl Kangur committed Dec 6, 2013
2 parents ed3b397 + 81c6b97 commit 1b3a6f3
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions libraries/Bluetooth/examples/RemoteLED/RemoteLED.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/***************************************************************************************
*
* Title: Remote LED
* Description: Turn the on-board LED on and off by Bluetooth.
* Tip: After upload, select the Bluetooth port with Tools > Port and send 1
* or 0 with the Serial Monitor. Don't forget to select the USB port back
* before uploading.
*
***************************************************************************************/
#include <prismino.h>
#include <Bluetooth.h>

void setup()
{
// open Bluetooth communication and wait for port to open
delay(1000);
Bluetooth.begin(9600);
delay(1000);

// set pin output mode (sources current)
pinMode(LED, OUTPUT);
}

void loop()
{
if(Bluetooth.available())
{
// read value received by Bluetooth
char val = Bluetooth.read();

switch (val)
{
case '1':
// turn LED on
digitalWrite(LED, HIGH);
break;
case '0':
// turn LED off
digitalWrite(LED, LOW);
break;
}
}
delay(1);
}

0 comments on commit 1b3a6f3

Please sign in to comment.