![]() I’ll update when a bunch of code from 3 people gets integrated. This will work fine for non-blocking delays also. If the button is pressed while Arduino is paused waiting for the delay() to pass, your program will miss the button press. In this case, you can’t use delay(), because Arduino pauses your program during the delay(). For example you might want to blink an LED while reading a button press. *-–( Declare User-written Functions )-–*/ Sometimes you need to do two things at once. MsChokewasClosed = choke_millis.elapsed() // Record this start attempt GeneratorState = RUNNING_NORMAL_STATE // Will open choke, stop starter If (AC_powerDetected) // The generator engine has started Serial.println(“STARTER ran too long, failure”) The built-in LED will stay the same, on and off every 1 second. ![]() If (starter_millis.elapsed() >= MAX_STARTER_MS) In this code we are adding one more LED to the circuit. The second program will show you how to use a potentiometer to control the. ![]() If (choke_millis.elapsed() >= MAX_CHOKE_MS) // Long enough time Learn how to control servo motors on the Arduino with this tutorial complete. Serial.println(“ATTEMPTING TO START ENGINE”) Serial.println(“TEST OF Stopwatch for engine controls”) Int msChokewasClosed // Record the history of this startup event *-–( Declare Constants and Pin Numbers )-–*/Įnum generatorState = INIT_STATE // Set first state at code start PURPOSE: Test timing for engine starting (Fragment) See: Īfter funny compile stuff, I have this example running on ESP32: OK, after some discussions I have used Rob Tillart’s “stopwatch_RT” library successfully for doing timing and timeouts for my GeneratorSet engine starting code. The one who dies with the most Parts LOSES! WHAT DO YOU NEED? Regards, Terry King…In The Woods In Vermont THANKS! Any comments or suggestions or critique welcome! Can you give us any guidance on the response time needed for the WiFi/Server code running in an ESP32 VS other user code? So, my RealTime Worry is: ESP32 co-hosting Wifi, Server, engine/generator controller state machine, with needed delays and timeout checks. We plan to put out a WiFi server that is the user interface: THANKS for your guidance on that stuff! So, engine starting, stopping, power monitoring etc. The project is remote control of generator sets used in many home and RV environments. I was trying to avoid the complexity of FreeRTOS. ![]() All this can be done by changing the value given to the delay() function. I love RealTime stuff and wrote a lot in EDL/EDX at IBM 30 years ago, and wrote a working 6502 RTOS. You can modify it so that it stays on for 30 seconds. I have also messaged Rob Tillart who wrote stopwatch_RT and has written many arduino libraries, to ask similar questions. I will come back here with my results and experiences. First MANY Thanks to you and to Rui for the incredible effort you have put into making Arduino and ESP32 understandable and fun for so many people! I write which took a different approach and has nowhere near the quantity and detail of information that you guys have done. ![]()
0 Comments
Leave a Reply. |