유은제gledel
Published

Bluetooth-Serial Monitor-Smartphone Chat/LED (sw)

Chat with your computer by using your smart phone. You can also turn on and off the LED with your phone!

BeginnerProtip628
Bluetooth-Serial Monitor-Smartphone Chat/LED (sw)

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Bluetooth Low Energy (BLE) Module (Generic)
×1
LED (generic)
LED (generic)
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×8

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schemetics of bluetooth(SW, Chat)

Schemetics of bluetooth (SW, LED)

Code

code of software connection (chat, terminal mode)

EJS
//Chat
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(12, 13);

void setup() {
  Serial.begin(9600);
  BTSerial.begin(9600);
}

void loop() {
  if (BTSerial.available())
  Serial.write(BTSerial.read());
  if (Serial.available())
  BTSerial.write(Serial.read());
}

code of software connection (LED, switch mode)

EJS
//LED
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(12,13);
int led = 8;
 char command;
 
void setup() {
  Serial.begin(9600);
  BTSerial.begin(9600);
}
 
void loop() {
  if(BTSerial.available()){
  char command = BTSerial.read();
  Serial.println(char(command));
  if (command == 'Y'|| command == 'y'){
    digitalWrite(led, HIGH);
  }
  else if (command == 'N' || command == 'n'){
    digitalWrite(led, LOW);
  }
}
}

Credits

유은제
15 projects • 13 followers
Hello :-) I'm a high school student in South Korea.
gledel
100 projects • 116 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"

Comments