본문 바로가기

아두이노4

ESP32 BLE 통신 /*    Video: https://www.youtube.com/watch?v=oCMOYS71NIU    Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp    Ported to Arduino ESP32 by Evandro Copercini   Create a BLE server that, once we receive a connection, will send periodic notifications.   The service advertises itself as: 6E400001-B5A3-F393-E0A9-E.. 2024. 7. 24.
ESP32 HX711 로드셀 무게감지 센서 #include "HX711.h"const int LOADCELL_DOUT_PIN = 5; // 데이터 출력 핀const int LOADCELL_SCK_PIN = 6;  // 시계 핀HX711 scale;void setup() {  Serial.begin(9600);  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);  Serial.println("HX711 calibration");  // 초기 영점 조정  scale.tare();  Serial.println("Put known weight on the scale and press any key to continue.");  while (!Serial.available()) {    delay(100);  }  .. 2024. 7. 23.
ESP32 OLED 출력하기 /*********************************************************************  This is an example for our Monochrome OLEDs based on SH110X drivers  This example is for a 128x64 size display using I2C to communicate  3 pins are required to interface (2 I2C and one reset)  Adafruit invests time and resources providing this open source code,  please support Adafruit and open-source hardware by purchasing .. 2024. 7. 22.
ESP32 타이머 인터럽트 사용하기 #include #include "esp32-hal-timer.h"// 타이머 포인터 변수 선언hw_timer_t *timer = NULL;volatile bool timerFlag = false;// 타이머 인터럽트 서비스 루틴void IRAM_ATTR onTimerISR() {  timerFlag = true; // 인터럽트 발생 플래그 설정}void setup() {  Serial.begin(115200); // 시리얼 통신 초기화  // 타이머 초기화: 주파수는 1MHz (1000000 Hz)  timer = timerBegin(1000000);  if (timer == NULL) {    Serial.println("Timer initialization failed!");    return;  .. 2024. 7. 22.