Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Sweep a servo motor using PWM in MicroPython on Mbed board.
from machine import Pin, PWM
from time import sleep
servo = PWM(Pin('D9'))
servo.freq(50)
def set_angle(angle):
duty = int(40 + (angle / 180) * 75)
servo.duty(duty)
while True:
for angle in range(0, 180, 5):
set_angle(angle)
sleep(0.05)
for angle in range(180, 0, -5):
set_angle(angle)
sleep(0.05)MBed is an open-source platform for developing IoT and embedded applications using C, C++, and Python. It provides an OS, hardware abstraction libraries, and development tools to rapidly create, test, and deploy programs on ARM Cortex-M microcontrollers.
Origin & Creator
Developed by ARM in 2011 to simplify IoT development and standardize embedded software across ARM Cortex-M microcontrollers.
Industrial Note
Extensively used in IoT devices, industrial automation, wearable electronics, robotics, and rapid prototyping of ARM-based microcontrollers.