Open chirag-uAtech opened 1 year ago
You can implement it simply by writing a command "wfi" it halts the microcontroller and waits for the interrupt to occur.
Before entering this command make sure that you have proper interrupt attached.
@MR-IC How do I do that? I am new to development on STM8 and can't find any function in the whole sduino library relating to this. It would help greatly if you can attach a simple code to go to sleep and then wake from button using EXTI.
Hi community,
I am new to Sduino and Stm8s. Have some prior experience working with Arduino, AVRs & STM32. I chose STM8s due to its lower price for a project. After developing the project, I need to reduce the current usage as much as possible to make the system Standby Mode. I have tried and failed while using Interrupt with a button.
For the sake of clear understanding, I want to develop a project that can control LED using a Push Button. I want the system to be in sleep mode for the rest of the time.
The sduino repo contains an example code for interrupt, that is:
The code does not get compiled in Arduino. On searching the internet for a bit, I found changing digitalPinToInterrupt(pin); to digitalPinToPort(pin); may work. The code gets compiled now but the result remains unexpected.
After digging some more into the problem, I found one more possible solution:
Source: https://github.com/tenbaht/sduino/issues/92
I tried this as well in my code. But still unable to make it work.
My requirement is to attachInterrupt on pin PA2 & use it to wake from sleep. Similar issues have been raised multiple times but not resolved completely.
Kindly provide some input on this problem.