1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M5NanoC6のPWMその2

Last updated at Posted at 2024-09-27

目的
サブマイコンにPWM信号を送ってラジコンサーボーを
制御したい。
PWM 5%から95%の90%で0度,1度から180度までを制御したい(予定)
とりあえずLED

結果

o_coq461.jpg

プログラム



//PWM_5_95_C6_1


//初期化
void setup() {

  //出力ピンの初期化
  pinMode(1, OUTPUT);
  analogWrite(1, 50); //PWM出力 50%

} //setup


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

    analogWrite(1,  13); //PWM出力  5% 256*0.05=12.8
    delay(2000); //2秒待つ

    analogWrite(1, 243); //PWM出力 95% 256*0.95=243.2
    delay(2000); //2秒待つ

} //loop


1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?