hello.
1. Reference link: https://github.com/stm32duino/STM32LowPower
2. MCU: STM32F103C8T6
Code: Select all
#include "STM32LowPower.h"
volatile int repetitions = 1;
#define BUZZER PB7
#ifndef USER_BTN
#define USER_BTN pinNametoDigitalPin(SYS_WKUP1)
#endif
const int pin = USER_BTN;
void setup() {
pinMode(pin, INPUT); pinMode(BUZZER, OUTPUT);
Serial.begin(115200);
Serial.println("STEP-1");
delay(10000);
Serial.println("STEP-2");
tone(BUZZER,1000,100); delay(500);
LowPower.begin();
LowPower.attachInterruptWakeup(pin, repetitionsIncrease, CHANGE, DEEP_SLEEP_MODE); // SLEEP_MODE
}
void loop() {
tone(BUZZER,1000,100); delay(1000);
LowPower.deepSleep();
}
void repetitionsIncrease() {
repetitions ++;
}
Q1) Is the pin corresponding to ‘SYS_WKUP1’ ‘PA0’?
Q2) ‘Wake up’ does not work after operation 1.
help.