I tried to test my STM32F103C8T6 timer but it didn't work.
Can you help me?
Code: Select all
#if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION < 0x01090000)
#error "Due to API change, this sketch is compatible with STM32_CORE_VERSION >= 0x01090000"
#endif
void Update_IT_callback(void)
{
digitalWrite(PA11, !digitalRead(PA13));
}
void setup() {
#if defined(TIM1)
TIM_TypeDef *Instance = TIM1;
#else
TIM_TypeDef *Instance = TIM2;
#endif
pinMode(PA11, OUTPUT);
digitalWrite(PA11, HIGH);
delay(1000);
digitalWrite(PA11, !digitalRead(PA13));
HardwareTimer *MyTim = new HardwareTimer(Instance);
//MyTim->setPrescaleFactor(72000000);
MyTim->setOverflow(1, HERTZ_FORMAT);
MyTim->attachInterrupt(Update_IT_callback);
MyTim->resume();
}
void loop() {
}