Replies: 2 comments 3 replies
-
Check out the Custom Code section. You need to add that code yourself: |
Beta Was this translation helpful? Give feedback.
-
got it, in case if someone needs:, voltage divider hooked to GPIO35 and illumination sensor on GPIO34. Voltage below 15% going to heartbeat led on GPIO4 my_custom.cpp file: /* MIT License - Copyright (c) 2019-2022 Francis Van Roie // USAGE: - Copy this file and rename it to my_custom.cpp #include "hasplib.h" #if defined(HASP_USE_CUSTOM) && true // <-- set this to true in your code #include "hasp_debug.h" unsigned long last_blink = 0; const int LED_BUILTIN1 = 4; //red float batteryFraction; // Implement heartbeat led //Voltage read void custom_setup() void custom_loop()
} // Function to update the LED brightness for a heartbeat effect // Check if it's time to update the LED brightness
} void custom_every_second() void custom_every_5seconds()
} bool custom_pin_in_use(uint8_t pin)
} void custom_get_sensors(JsonDocument& doc) void custom_topic_payload(const char* topic, const char* payload, uint8_t source){ #endif // HASP_USE_CUSTOM my_custom.h file: /* MIT License - Copyright (c) 2019-2022 Francis Van Roie // USAGE: - Copy this file and rename it to my_custom.h #ifndef HASP_CUSTOM_H #include "hasplib.h" /* This function is called at boot */ /* This function is called every itteration of the main loop */ /* This function is called every second */ /* This function is called every 5 seconds */ /* This function is called when battery voltage is below 15% */ /* return true if the pin used by the custom code */ /* Add a key which defines a JsonObject to add to the sensor JSON output */ /* Receive custom topic & payload messages / #endif // HASP_USE_CUSTOM #endif // HASP_CUSTOM_H |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Questions
Is there possibility or any example how to read analog data from GPIO on esp32 with installed openHASP?
I would like to display battery level of the battery operated device and implement shutdown on level below certain value.
Beta Was this translation helpful? Give feedback.
All reactions