김진욱gledel
Published

Arduino Control With Bluetooth

Arduino control with Bluetooth.

BeginnerProtip2 hours482
Arduino Control With Bluetooth

Story

Read more

Code

Bluetooth Serial

Arduino
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(12, 13);
void setup() {
  Serial.begin(9600);
  BTSerial.begin(9600);

}

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

}

LED control with Bluetooth Serial

Arduino
#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') {
   analogWrite(led, 200);
  }
  else if(command == 'N' || command == 'n'){
    analogWrite(led, 0);
 }
 }

}

Credits

김진욱
7 projects • 1 follower
highschool student learning 3D Priinting in Fab Lab
Contact
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!"
Contact

Comments

Please log in or sign up to comment.