Created
October 10, 2021 18:19
-
-
Save ScienceElectronicsFun/eca1444551e9e79215511272f71123a2 to your computer and use it in GitHub Desktop.
Code for activating solenoid and pneumatic cylinder using raspberry pi pico
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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