Reading LittleFS file into buffer for sending to another ESP32 via ESP Now. Created dummy file 1321 bytes long with "sensor" information in the form like this: uint8_t sensorData1[] = "[ 00 12:05:12:06:01 22 33 44 \n"; Red stuff above is timestamp to later get in real time from DS3231. Blue stuff is dummy sensor information, two ascii chars representing 00 to 99. Black stuff is just formatting chars and spaces. The following program reads in about 43 lines of sensor information as above and puts it into LittleFS file called sensorReadings.txt. This file then gets cut up into 200 byte chunks (via sendBuf[200] ) and gets sent to dummy sender file called sendNowBuf(). No actual sending takes place, so next sub-project is to send the 200 byte chunks one by one via ESPNow to second ESP32. //41 From Arduino Examples/mnt/c/Users/Dell/Documents/Arduino/Working202411/LITTLEFS_test2/LITTLEFS_test2.ino #include <Arduino.h> #include "FS.h" #include <Li...
ESP32 buttons and bouncing Rigged up button to GPIO 21 to explore, button presses, debouncing and interrupts. Following worked. /* * This ESP32 code is created by esp32io.com Worked 7/11/24 * * This ESP32 code is released in the public domain * * For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-button-debounce */ #include <ezButton.h> #define DEBOUNCE_TIME 50 // the debounce time in millisecond, increase this time if it still chatters ezButton button ( 21 ) ; // create ezButton object that attach to pin GPIO21 void setup () { Serial . begin ( 9600 ) ; button . setDebounceTime ( DEBOUNCE_TIME ) ; // set debounce time to 50 milliseconds } void loop () { button . loop () ; // MUST call the loop() function first if ( button . isPressed ()) Serial . println ( "The button is pressed" ) ; if ( button . isReleased ()) Serial . pri...
Comments
Post a Comment