Page 1 of 1

ExternalWakeup / Does not work. help me.

Posted: Wed Jun 12, 2024 1:28 am
by myksj1105
ExternalWakeup / Does not work. help.

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.

Re: ExternalWakeup / Does not work. help me.

Posted: Wed Jun 12, 2024 1:40 am
by myksj1105

Code: Select all

const int pin = PA0;
I changed it to and it works.