Skip to content

Instantly share code, notes, and snippets.

@BjoernSchilberg
Last active May 11, 2022 19:07
Show Gist options
  • Save BjoernSchilberg/e9376fdbb7ea5e5fb693b9ae4cccc1ee to your computer and use it in GitHub Desktop.
Save BjoernSchilberg/e9376fdbb7ea5e5fb693b9ae4cccc1ee to your computer and use it in GitHub Desktop.
PICO

Raspberry Pi Pico

Projects

Cytron Maker Pi Pico

Pico and Basic

Raspberry Pi Pico Links

Blink the internal led

from machine import Pin
from utime import sleep

print("Hello, Pi Pico!")

led = Pin(15, Pin.OUT)
while True:
  led.toggle()
  sleep(0.5)

Servo INTec HS-53

from time import sleep
from machine import Pin
from machine import PWM

pwm = PWM(Pin(15))
pwm.freq(50)

#Function to set an angle
#The position is expected as a parameter
def setServoCycle (position):
    pwm.duty_u16(position)
    sleep(0.01)
    
while True:
    for pos in range(800,8000,50):
        setServoCycle(pos)
    for pos in range(800,800,-50):
        setServoCycle(pos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment