From 45be1e14cdb2fb2ed1c386f5b4f74da8a08f9873 Mon Sep 17 00:00:00 2001 From: Eternal_plasma <61401963+Eternal-plasma@users.noreply.github.com> Date: Mon, 24 Feb 2020 17:12:39 -0600 Subject: [PATCH] Create simplified-bt.ino --- simplified-bt.ino | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 simplified-bt.ino diff --git a/simplified-bt.ino b/simplified-bt.ino new file mode 100644 index 0000000..33e05a1 --- /dev/null +++ b/simplified-bt.ino @@ -0,0 +1,21 @@ +//Edited by Eternal-plasma :) +char Bt_read = 0; //Variable for storing Bluetooth recive +void setup() +{ + Serial.begin(9600); //Sets the data rate in bits per second (baud) + pinMode(13, OUTPUT); //Sets digital pin 13 as output pin +} +void loop() +{ + if(Serial.available() > 0) //if you can get data then...... + { + Bt_read = Serial.read(); //Read the incoming data and store it into variable + Serial.print(Bt_read); //Print Value of Incoming_value in Serial monitor + Serial.print("\n"); //New line + if(Bt_read == '1') //Checks whether value of Incoming_value is equal to 1 + digitalWrite(13, HIGH); //If value is 1 then LED turns ON + else if(Bt_read == '0') //Checks whether value of Incoming_value is equal to 0 + digitalWrite(13, LOW); //If value is 0 then LED turns OFF + } + +}