- Arduino uno:- http://bit.ly/32tDrJQ
- Bluetooth module(HC-06):- http://bit.ly/2vmOF6N
- LED:- http://bit.ly/2vbBHJj
Connections:-
Bluetooth module(HC-06) to arduino
- VCC = Arduino 5v
- GND = Arduino GND
- RX pin = Arduino TX (1)
- TX pin = Arduino RX (0)
LED to arduino
- LED ( - ) = Arduino GND
- LED ( + ) = Arduino digital pin13
YOU MUST REMOVE RX,TX PIN BEFORE UPLOADING CODE
char val;
void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
val = Serial.read();
Serial.println();
}
if (val == '1')
{ digitalWrite(13, HIGH);
}
else
if (val == '2')
{
digitalWrite(13, LOW);
}
delay(100);
}