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

본문 바로가기
사이트 내 전체검색

arduino

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

작성자 웹지기
작성일 21-01-22 17:43 | 조회 8,635 | 댓글 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

댓글목록 0

등록된 댓글이 없습니다.

arduino 목록

Total 25
게시물 검색

회원로그인

접속자집계

오늘
27,566
어제
24,727
최대
61,067
전체
18,024,893

그누보드5
Copyright © funyphp.com. All rights reserved.