Skip to content

Instantly share code, notes, and snippets.

@kasparsd
Created October 12, 2019 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasparsd/65f1e4982c03b9acea3576ba603e7eab to your computer and use it in GitHub Desktop.
Save kasparsd/65f1e4982c03b9acea3576ba603e7eab to your computer and use it in GitHub Desktop.
Main logic behind a battery powered esp32 timelapse camera
onInteruptInterval( MINUTEINSECONDS, function() {
takePicture()
goToSleep()
} )
onInteruptInterval( DAYINSECONDS, function() {
connectWifi()
.then( () => uploadImages( getNewPhotos() ) )
.finally( () => disconnectWifi() )
} )
onInteruptEvent( WIFICLIENTCONNECT, function() {
// Enable live feed.
} )
onInteruptEvent( WIFICLIENTDISCONNECT, function() {
// Disable the live feed and put to sleep.
} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment