LoginSignup
0
0

More than 3 years have passed since last update.

pi picoでmicropython その8

Posted at

概要

picoでmicropythonやってみた。
pwm使ってみた。

サンプルコード

import time
from machine import Pin, PWM
pwm = PWM(Pin(25))
pwm.freq(1000)
duty = 0
direction = 1
while True:
   duty += direction
   if duty > 255:
      duty = 255
      direction = -1
   elif duty < 0:
      duty = 0
      direction = 1
   pwm.duty_u16(duty * duty)
   time.sleep(0.001)


以上。

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