[ arduino ] 블루투스 와 스마트폰을 이용해서 LED 켜고 끄기 > arduino

본문 바로가기

사이트 내 전체검색

arduino

[ arduino ] 블루투스 와 스마트폰을 이용해서 LED 켜고 끄기

작성일 21-01-22 17:43

페이지 정보

작성자 웹지기 조회 2,415회 댓글 0건

본문

블루투스 와 스마트폰을 이용해서 LED 켜고 끄기

 

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX


void setup() {

  Serial.begin(9600);

  mySerial.begin(9600);


  pinMode(7, OUTPUT);

}


void loop() { // run over and over

  char c = '0';

  if (mySerial.available()) {

    c = mySerial.read();

  } else if (Serial.available()) {

    c = Serial.read();

  }

  

  if (c == '1') {

    digitalWrite(7, HIGH);

  } else  if (c == '2') {

    digitalWrite(7, LOW);

  }

}

 

20210125_1.png


추천0

비추천 0

댓글목록

등록된 댓글이 없습니다.

전체 25건 1 페이지

이미지 목록

게시물 검색
Copyright © 즐거운 코딩 생활 ( funyphp ). All rights reserved.
PC 버전으로 보기