Loading...
Searching...
No Matches
Examples

Example scripts for the Phyduino Pico. There are two sets with the same examples: pick the library you want to use.

Examples Uses Laid out as
arduino.py examples The Arduino-style functions: from arduino import *; pinMode(), digitalWrite(), analogRead() (0-1023), analogWrite() (0-255), delay(), millis() An Arduino sketch: setup() runs once, then loop() runs over and over
phyduino.py examples The Phyduino Pico library: import phyduino as mcu; pin(), pwm(), On-board LED, analog_read() (0-4095), time.sleep() A plain MicroPython script: the set-up code at the top runs once, then a while True: loop runs over and over

Choose arduino.py if you know Arduino or want code that reads like an Arduino sketch, and phyduino.py for the usual MicroPython style and the board's full resolution.

Blink, in each set
arduino.py (the main() at the end of each file is left out here):
from arduino import *
def setup():
pinMode(LED_BUILTIN, OUTPUT)
def loop():
digitalWrite(LED_BUILTIN, HIGH)
delay(500)
digitalWrite(LED_BUILTIN, LOW)
delay(500)
phyduino.py:
import time
import phyduino as mcu
while True:
mcu.led.toggle()
time.sleep(0.5)