LoginSignup
0
0

More than 1 year has passed since last update.

STM32L010でLED2を割込みで点滅させます(タイマー割り込みで遊ぶ)

Last updated at Posted at 2022-04-23

x まだ試していない 成功しました。2022/4/32 22:48

参考

もとの資料

STM32L010のプログラム
変更点は、PA_4とPA_5



#include "mbed.h"
 
Ticker flipper;
DigitalOut led1(PA_4);
DigitalOut led2(PA_5);
 
void flip() {
    led2 = !led2;
}
 
int main() {
    led2 = 1;
    flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds)
 
    // spin in a main loop. flipper will interrupt it to call flip
    while(1) {
        led1 = !led1;
        wait(0.2);
    }
}



サンプル

本プログラムは、イメージです。
性能を保証するものでは、ありません。
個人的な感想です。 みるみる若返りました。(冗談) ただのサンプル(冗談)

いろいろ
余計な情報 現時点21:04 ふろ入ってくるわ



#include "mbed.h"
 
Ticker flipper;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
 
void flip() {
    led2 = !led2;
}
 
int main() {
    led2 = 1;
    flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds)
 
    // spin in a main loop. flipper will interrupt it to call flip
    while(1) {
        led1 = !led1;
        wait(0.2);
    }
}


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0