-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBluetermDemo
More file actions
42 lines (36 loc) · 1.49 KB
/
BluetermDemo
File metadata and controls
42 lines (36 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/****************************************************************************
* Copyright(C) : National Central University ROD Lab Jen Hao Chen (Howard)
* Create Date : 2014/07/28 by Howard Chen
* Modified Date: 2014/09/25 by Howard Chen
* Abstract : This program will test the connection of the phone and Arduino borad via
bluetooth module. This program will let the led on Arduino borad to turn on
and turn off depends on the botton that you touch on phone.
* Reference : None
/*****************************************************************************/
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop()
{
if(Serial.available())
{
unsigned char charreceived = Serial.read();
switch(charreceived)
{
case '1':
digitalWrite(13, HIGH);
Serial.println("Arduino Led On");
break;
case '0':
digitalWrite(13, LOW);
Serial.println("Arduino Led Off");
break;
default:
break;
}
Serial.flush();
}
delay(10);
}