Gif of Program in Action:
Photo of environment:
Gif of Program in Action:
Gift of Program in Action:
Photo of environment:
Gif of Program in Action:
Photo of environment:
To create a program that will flash the LED’s in order of Red, Green, Blue.
The Source code can be downloaded here here
#---------------------------------------------------------
# Jonah Watts
# Assignment 1, Project 1
# For CMPT 401
#---------------------------------------------------------
from time import sleep_ms
from machine import Pin
#Setup the LED Diodes for the pin in and outs
ledRed=Pin(19,Pin.OUT)
ledGreen=Pin(18,Pin.OUT)
ledBlue = Pin(5,Pin.OUT)
try:
while True:
#Rotate between red, green, and blue
ledRed.value(1)
sleep_ms(1000)
ledRed.value(0)
ledGreen.value(1)
sleep_ms(1000)
ledGreen.value(0)
ledBlue.value(1)
sleep_ms(1000)
ledBlue.value(0)
except:
pass
The goal of this project is to create a system that has two push buttons and an LED. The LED will be turned on by one button, and only one button. The other button will turn the LED off, and that is all.
The Source code can be downloaded here here
#---------------------------------------------------------
# Jonah Watts
# Assignment 1, Project 2
# For CMPT 401
#---------------------------------------------------------
import time
from machine import Pin
# First set up the pins
led = Pin(0, Pin.OUT)
button1 = Pin(14, Pin.IN,Pin.PULL_UP)
button2 = Pin(12, Pin.IN,Pin.PULL_UP)
# If one button is clicked, turn on the LED, if the other one is clicked, turn it off
while True:
if not button1.value():
led.value(1)
if not button2.value():
led.value(0)