![]() here you read data, process it and send! ENABLE SLEEP - this enables the sleep modeīool sendData = true // tracks if you need to send data set pin to input with a pullup, DONE to outputĪttachPCINT(digitalPinToPCINT(drvPin), do_smth, FALLING) // DRV goes LOW, when TPL time has elapsed BOD DISABLE - this must be called right before the asm sleep instruction MCUCR |= (3 << 5) //set both BODS and BODSE at the same time MCUCR = (MCUCR & ~(1 << 5)) | (1 << 6) //then set the BODS bit and clear the BODSE bit at the same time asm volatile(“sleep”) //in line assembler to go to sleep #include "PinChangeInterrupt.h" // this one Still no joy when the tpl switch receive HIGH on done_pin, i expect it to start its timer, and when timer expire, goes from HIGH to LOW on the drv_pin, thus triggering a FALLING event, thus calling my ISR, i don’t get it why this time it doesn’t work still when the DRIVERPIN switch from HIGH to LOW, it means the timer is expired, thus time to trigger ISRĪttachInterrupt(digitalPinToInterrupt(drv_pin), do_smth, mode) ![]() ![]() reset tpl5110 timer for an another round Serial.println("just woke up!") //next line of code executed after the interruptĮvery seconds, coming from esp32 world where all i had to do for sleeping was calling a function is a big change for me, and i might overestimated myself DetachInterrupt(done_pin) //Removes the interrupt from pin 2 ĭelay(5000) //let’s pretend we do some calculations here for 5 secondĭigitalWrite(done_pin, HIGH) //restart timerĪttachInterrupt(done_pin, wakeUp, LOW) //attaching a interrupt to pin d2 ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |