Created
July 2, 2017 15:28
-
-
Save rseaman/7798b219ffa97878e049270d7ae573cd to your computer and use it in GitHub Desktop.
key input pseudo code
This file contains 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
# This garbage code is just here to demonstrate an idea :) | |
import key # We're pretending this is a module that can tell us when a key is pressed. | |
# Pretend these are RGB values. Also you would probably want a multi-dimensional array to check | |
# but again, let's keep it simple here. | |
light1 = [0, 0, 0] | |
light2 = [0, 0, 0] | |
light3 = [0, 0, 0] | |
keyPressed = false | |
while true: # Just loop forever (usually a bad idea) | |
keyPressed = key.read() | |
if keyPressed is true: | |
light1[0] += 1 # We turn up the value of Red in each light | |
light2[0] += 1 | |
light3[0] += 1 | |
# Either way, display the lights | |
light1.display() | |
light2.display() | |
light3.display() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment