MicroPython API
Beetle S1 runs on MicroPython and supports most MicroPython standard libraries. Below are commonly used modules for light effect development.
Common Standard Libraries
machine — Hardware Control
from machine import Pin, PWM, ADC
# Set GPIO pin
pin = Pin(4, Pin.OUT)
pin.value(1) # Output high
# PWM control
pwm = PWM(Pin(5))
pwm.freq(1000) # Set frequency
pwm.duty(512) # Set duty cycle
time — Timing Control
import time
time.sleep(1) # Delay 1 second
time.sleep_ms(500) # Delay 500 milliseconds
time.ticks_ms() # Get current milliseconds
math — Math Operations
import math
# Used for generating smooth light animations
value = math.sin(angle) # Sine wave
value = math.cos(angle) # Cosine wave
More Resources
The MicroPython official documentation provides a complete standard library reference:
For Beetle S1 custom APIs, please refer to the Custom API section.