Skip to content

Instantly share code, notes, and snippets.

@ScienceElectronicsFun
Created September 26, 2021 20:46
Show Gist options
  • Save ScienceElectronicsFun/072ca2d526ba77a937bcafbffef0d27f to your computer and use it in GitHub Desktop.
Save ScienceElectronicsFun/072ca2d526ba77a937bcafbffef0d27f to your computer and use it in GitHub Desktop.
Controlling a Gikfun DC motor with a raspberry pi pico
from machine import Pin
import time
led = Pin(15, Pin.OUT)
button = Pin(14, Pin.IN, Pin.PULL_DOWN)
while True:
if button.value():
led.value(1)
time.sleep(1)
led.value(0)
else:
led.value(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment