LoginSignup
0
0

STM32C011のPWMで遊ぶ(STM32C011J4M7)

Last updated at Posted at 2024-01-28

STM32C011のPWMで遊ぶ(STM32C011J4M7)

目的
PWMのテスト

o_cop905.jpg




//SER_LB_9600_PWM_C011_1


//ヘッダー
#include <Arduino.h>


//定義
#define DD PA8    // potentiometer connected to analog pin x


//初期化
void setup() {

  pinMode(DD, OUTPUT);   // sets the LED pin as output
  analogWriteFrequency(50);   //周波数
  analogWriteResolution(16);  //分解能

}//setup


//メインループ
void loop() {


  for (int ii = 0; ii < 256; ii++) {


    analogWrite(DD, 1310 + (26 * ii) );   // analogRead values go from 0
                                          // to 4095, pwmWrite values
                                          // from 0 to 65535, so scale roughly



    delay(20); //20mS

  }//for

}//loop




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