보드에 장착된 Builtin LED GPIO 는 포트번호는 2를 OnOff 해봅니다.
아래 소스를 업로드 해봅니다.
#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
void setup() {
Serial.begin(115200);
pinMode(2,OUTPUT);
SerialBT.begin("ESP32test"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
}
void loop() {
if (Serial.available()) {
SerialBT.write(Serial.read());
}
if (SerialBT.available()) {
Serial.write(SerialBT.read());
}
delay(20);
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(2,LOW);
delay(500);
}
'코딩 놀이' 카테고리의 다른 글
cnc Chield V4 부르투스 통신(8) (0) | 2024.11.23 |
---|---|
CNC Shield_V4 , BT06 bluetooth, appInventor(7) (0) | 2024.11.23 |
arduino 와 esp32 bluetooth(5) (0) | 2024.11.19 |
arduino substring() 함수와 배열(집합) 응용 (4) (0) | 2024.11.17 |
arduino 배열 (3) (0) | 2024.11.16 |