Skip to content

Instantly share code, notes, and snippets.

@ScienceElectronicsFun
Created October 10, 2021 18:19
Show Gist options
  • Save ScienceElectronicsFun/eca1444551e9e79215511272f71123a2 to your computer and use it in GitHub Desktop.
Save ScienceElectronicsFun/eca1444551e9e79215511272f71123a2 to your computer and use it in GitHub Desktop.
Code for activating solenoid and pneumatic cylinder using raspberry pi pico
from machine import Pin
import time
led = Pin(15, Pin.OUT)
button = Pin(14, Pin.IN, Pin.PULL_DOWN)
blueLED = Pin(16, Pin.OUT)
blueLED.value(0)
while True:
if button.value():
print("ACTIVATION SEQUENCE")
for i in range(0,20):
blueLED.value(1)
time.sleep(0.1)
blueLED.value(0)
time.sleep(0.1)
led.value(1)
time.sleep(1)
led.value(0)
time.sleep(1)
led.value(1)
time.sleep(1)
led.value(0)
time.sleep(1)
else:
led.value(0)
print(button.value())
#time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment