Matti Airas
Matti Airas
Explore posts from servers
SKSignal K
Created by Greg Young on 11/19/2024 in #sensesp
Greg Young - Help with sensESP code ..please 🙂...
You're right that you shouldn't use delay in SensESP code - that blocks the whole event loop from working. But creating a pulse is still quite simple.
# first, trigger the positive edge
digitalWrite(output_gpio, true);

# then, create a delay and a callback that is executed when the delay event gets triggered
event_loop()->onDelay(pulse_length_ms, []() {
# inside this callback function, trigger the negative edge
digitalWrite(output_gpio, false);
});
# first, trigger the positive edge
digitalWrite(output_gpio, true);

# then, create a delay and a callback that is executed when the delay event gets triggered
event_loop()->onDelay(pulse_length_ms, []() {
# inside this callback function, trigger the negative edge
digitalWrite(output_gpio, false);
});
The delays are not totally accurate but unless something is off, should be there within a fraction of a ms. To wrap this code into a consumer that can be used with ValueListeners, you use a LambdaConsumer:
auto pulse_consumer = new LambdaConsumer<bool>([](bool value) {
digitalWrite(output_pin, value);
event_loop()->onDelay(pulse_length_ms, [value]() {
digitalWrite(output_gpio, !value);
});
}

cockpit_lights_listener->connect_to(pulse_consumer);
auto pulse_consumer = new LambdaConsumer<bool>([](bool value) {
digitalWrite(output_pin, value);
event_loop()->onDelay(pulse_length_ms, [value]() {
digitalWrite(output_gpio, !value);
});
}

cockpit_lights_listener->connect_to(pulse_consumer);
2 replies
SKSignal K
Created by Kees Verruijt on 9/5/2024 in #announcements
METS 2024
I created the #mets channel for coordinating meetings etc.
12 replies
SKSignal K
Created by Greg Young on 11/15/2024 in #sensesp
Greg Young - sensESP V3 decided to give V3 an...
And what is the "tank sensor example"?
7 replies
SKSignal K
Created by Greg Young on 11/15/2024 in #sensesp
Greg Young - sensESP V3 decided to give V3 an...
Also, make sure that there are no platform or library updates available on PlatformIO (have a look at the "alien" menu).
7 replies
SKSignal K
Created by Greg Young on 11/15/2024 in #sensesp
Greg Young - sensESP V3 decided to give V3 an...
Could you specify what modifications you have made to the project template?
7 replies
SKSignal K
Created by Matti Airas on 11/14/2024 in #sensesp
Matti Airas - @rszemeti : Yeah, PR would be gre...
It's debatable whether an interpolator should be extrapolating values beyond the endpoints, but that's the current behavior, and I forgot to do anything about it during the v3 development cycle.
1 replies
SKSignal K
Created by blohminator on 11/11/2024 in #sensors
blohminator - I have installed a Lidar sensor a...
SensESP is the canonical way to interface ESP32 devices with Signal K. Have a look at this tutorial for instructions on interfacing your code with it: https://signalk.org/SensESP/pages/tutorials/arduino_style/ If you have no prior experience with SensESP, go first through the Getting Started section: https://signalk.org/SensESP/pages/getting_started/
5 replies
SKSignal K
Created by Greg Young on 11/8/2024 in #sensesp
Greg Young - trying to update older but working...
I don't quite remember when the push button interface was implemented, but if your device has a button connected to GPIO2, a long button press should reset the device configuration, hopefully the WiFi stuff as well.
4 replies
SKSignal K
Created by Greg Young on 11/8/2024 in #sensesp
Greg Young - trying to update older but working...
The ESP32 Arduino framework stores the wifi credentials on the device EEPROM (if I remember correctly). I've tried my best to ignore those and always use the hardcoded or filesystem values instead, but it can be a bit wonky.
4 replies