Skip to content

STM32の教育資料(執筆途中)#19

Open
NAMATAMAGO314 wants to merge 8 commits intomainfrom
namatamago/lowlayer
Open

STM32の教育資料(執筆途中)#19
NAMATAMAGO314 wants to merge 8 commits intomainfrom
namatamago/lowlayer

Conversation

@NAMATAMAGO314
Copy link

STM32初心者向けの教育資料

  • 内容はGPIO、PWM、UART、Timer、CAN(途中)

- UART通信・USART通信
- GPIO
- PWM(GPIOピンでやる)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIMER
CAN, SPI, I2C
ADC

{
if (htim->Instance == TIM2) { // TIM2からの割り込み
led_timer++;
if (led_state == 0 && led_timer >= 500) { // 消灯500ms経過
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timerの次の周期を変えるようにしたら

書き終わったら、main.cをmain.cppにしてbuildをします。0error , 0warningsになればOKです。エラーが出た場合、設定したtimと割り込み開始関数にかいたtimの番号が違っている場合があります。
ST-Linkを接続し、虫のマークを押してDebugし、再生ボタンを押せば基板にある小さなLED達が点滅します。Debugできない場合は、ST-Linkの接続不良か、モバイルバッテリーなどの電源供給ができていない可能性があります。
うまくできたら、今回の目標は達成です。お疲れさまでした。次回はCAN通信をやります。お楽しみに!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

エンコーダーモードに触れておいて

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants