【Raspberry Pi Pico】DCモーターをモータードライバで制御する | メタエレ実験室 (hellobreak.net) PWM制御も詳しい,ただしサーボは
https://qiita.com/SamAkada/items/0f3454fb1e65bec3a94e でないとだめだった
------------------------------------------------------------------------------
BluetoothモジュールでLチカ:PicoWでも成功した
from machine import UART,Pin
import time
led = Pin(7,Pin.OUT)
u = UART(0,9600,tx=Pin(0),rx=Pin(1))
def receiveCommand():
temp = u.readline()
if temp is not None:
temp = str(temp, 'UTF-8')
return temp
while True:
cmd = receiveCommand()
print(cmd)
if cmd == "a":
lef.value(1)
time.sleep(1)
led.value(0)
# time.sleep(1) これをいれるとつながらなくなった!要注意!
---------servo pwm ファームウエア更新後Pin0不通 上記参照--------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from machine import PWM, Pinimport timepwm1 = PWM(Pin(0))pwm1.freq(50)i = 0;servo1 = PWM(Pin(0))servo1.freq(50)max_duty = 65025dig_0 = 0.0725 #0°dig_90 = 0.12 #90°dig_m90 = 0.025 #-90°while True : servo1.duty_u16(int(max_duty*dig_0)) time.sleep_ms(1000) servo1.duty_u16(int(max_duty*dig_90)) time.sleep_ms(1000) servo1.duty_u16(int(max_duty*dig_0)) time.sleep_ms(1000) servo1.duty_u16(int(max_duty*dig_m90)) time.sleep_ms(1000) |
------------------------------------------------------------------------------------------
https://microcontrollerslab.com/raspberry-pi-pico-w-soft-access-point-web-server-example/:: 成功 sapでない、遠隔操作は
ラズパイPicoW Wi-Fi通信、遠隔操作&表示 MicroPython編 | ロジカラブログ (logikara.blog) などがある
0 件のコメント:
コメントを投稿