Last active
May 12, 2017 02:19
-
-
Save giljr/f82d806965441d1c2fb43088bcca66f6 to your computer and use it in GitHub Desktop.
Please, follow this page: https://goo.gl/pMAsOa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Project name: | |
01 #kidSerie - Arduino & MIT App Instaler 2 & HC-06 | |
(Smart Phone App!) | |
Flavour II - | |
Hex File: _01_kidSerie_sketch_02.HelloBT.ino | |
Revision History: | |
20161008: | |
- board found on https://www.hackster.io/ Examples | |
(connect everything on HC-06 to access arduino by smart phone) | |
Description: | |
This program lets you to control a LED on pin 13 of arduino using a bluetooth module. | |
MCU: Arduino 1.6.12 - @16MHz http://www.arduino.cc/ | |
IC Chip: Bluetooth Datasheet - HC-06 https://goo.gl/s9ZcNC | |
Connections: | |
See Official youtube channel vids: https://youtu.be/u1xqW6qtFXs | |
Based on: Bluetooh Basic: LED ON OFF | |
Website: http://bit.do/Avishkar | |
Code by: Mayoogh Girish | |
Down : https://github.com/Mayoogh/Arduino-Bluetooth-Basic | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License v3 as published by the Free Software Foundation | |
*/ | |
#include <SoftwareSerial.h> | |
SoftwareSerial mySerial(10, 11); // RX, TX | |
char data = 0; // Variable for storing | |
// received data | |
void setup() | |
{ | |
Serial.begin(9600); // Sets the baud for serial | |
// data transmission | |
mySerial.begin(9600); // Set this baudrate | |
pinMode(13, OUTPUT); // Sets digital pin 13 as | |
// output pin | |
} | |
void loop() | |
{ | |
if (mySerial.available() > 0) // Send data only when you | |
// receive data: | |
{ | |
data = mySerial.read(); // Read the incoming data & | |
// store into data | |
Serial.println(data); // Print Value inside data in | |
// Serial monitor for debug | |
if (data == '1') // Checks whether value of | |
// data is equal to 1 | |
digitalWrite(13, HIGH); // If value is 1 then LED | |
// turns ON | |
else if (data == '0') // Checks whether value of | |
// data is equal to 0 | |
digitalWrite(13, LOW); // If value is 0 then LED | |
// turns OFF | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment