aboutsummaryrefslogtreecommitdiff
path: root/doc/Lesson 2 Bluetooth Car/bluetooth_blink
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-08-26 20:33:02 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-08-26 20:33:02 +0200
commitba216919262d7f888bfb99debf81babe1ce88e0e (patch)
tree16c19610a7a3a77c97b99a63f6ba85d11ebde4ec /doc/Lesson 2 Bluetooth Car/bluetooth_blink
parentd80736ab6e8e3cad2f1a30c6eaba2d6883dbe967 (diff)
Move lessons to doc
Diffstat (limited to 'doc/Lesson 2 Bluetooth Car/bluetooth_blink')
-rwxr-xr-xdoc/Lesson 2 Bluetooth Car/bluetooth_blink/bluetooth_blink.ino22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/Lesson 2 Bluetooth Car/bluetooth_blink/bluetooth_blink.ino b/doc/Lesson 2 Bluetooth Car/bluetooth_blink/bluetooth_blink.ino
new file mode 100755
index 0000000..5e357c1
--- /dev/null
+++ b/doc/Lesson 2 Bluetooth Car/bluetooth_blink/bluetooth_blink.ino
@@ -0,0 +1,22 @@
+//www.elegoo.com
+//2016.09.12
+
+int LED=13;//Define 13 pin for LED
+volatile int state = LOW;//The initial state of the function is defined as a low level
+char getstr; //Defines a function that receives the Bluetooth character
+void setup() {
+ pinMode(LED, OUTPUT);
+Serial.begin(9600);
+}
+/*Control LED sub function*/
+void stateChange()
+{
+ state = !state;
+ digitalWrite(LED, state);
+}
+void loop() {
+ getstr=Serial.read();//The Bluetooth serial port to receive the data in the function
+ if(getstr=='A'){
+ stateChange();
+ }
+}