Hardware/ESP

ESP32 시리얼 블루투스

초인로크 2023. 5. 16. 09:55
반응형

ESP32로 블루투스에 관련된 프로그래밍을 하는데,

 

데이터를 송수신할 경우에 스마트폰으로 "1"을 전송할 경우에는

 

ESP 측에서는 "1"의 아스키코드 "49"를 조건문으로 사용하고 있다.

 

 

https://circuitdigest.com/microcontroller-projects/using-classic-bluetooth-in-esp32-and-toogle-an-led

 

How to Use Classic Serial Bluetooth in ESP32

Bluetooth modules like HC-05 and HC-06 are easy to set-up and quick to use with Arduino IDE, but they have their own limitation like high power consumption and they operate on the old Bluetooth V2.0. Also, recently I got myself a new ESP32 DEV kit, these m

circuitdigest.com

 

 

아래는 아스키코드에 대한 위키 설명.

 

https://ko.wikipedia.org/wiki/ASCII

 

ASCII - 위키백과, 우리 모두의 백과사전

위키백과, 우리 모두의 백과사전. 1972 프린터 사용 설명서에 개시된 아스키 코드 차트표 미국정보교환표준부호(영어: American Standard Code for Information Interchange), 또는 줄여서 ASCII( , 아스키)는 영문

ko.wikipedia.org

 

 

이것을 스마트폰에서 "1"을 보내면 아두이노 측에서도 숫자 "1"을 이용하여 조건문을 만들 수는 없을까 생각 중이다.

 

아마도 신호를 수신할때 설정을 해 주면 될 거 같긴 한데..

 

시간이 없다 보니 공부를 소홀히 하니까 때때로 개발하다가 이렇게 의문점이 들어서 막혀 버리고는 한다.

 

어디 좋은 방법이 없는지 검토를 해 보고 싶은데,

 

찾으려 하다가도 다른 일 때문에 잊어버리고 지나쳐버려서,

 

일단은 이걸 잊어버리지 않기 위해 여기에 적어둔다.

 

 

https://github.com/pierdr/BLE_Swift_ESP32_SampleProject

 

GitHub - pierdr/BLE_Swift_ESP32_SampleProject: Connecting ESP32 and iOS

Connecting ESP32 and iOS. Contribute to pierdr/BLE_Swift_ESP32_SampleProject development by creating an account on GitHub.

github.com

 

 

그러고 나면 위의 샘플 코드도 좀 더 효율적으로 이용이 가능할 듯하다.

반응형