Skip to content

Instantly share code, notes, and snippets.

@izzuddin91
Created July 23, 2019 14:57
Show Gist options
  • Save izzuddin91/5b74321674ff21284d77a164db891c24 to your computer and use it in GitHub Desktop.
Save izzuddin91/5b74321674ff21284d77a164db891c24 to your computer and use it in GitHub Desktop.
setting up switch to display information on matrix led
import RPi.GPIO as GPIO
import time
import os
import csv
GPIO.setmode(GPIO.BCM)
#pin bawah skali, seblah ground
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
# with open('/media/usb1/operation_logs.csv', 'rb') as csvfile:
# reader = csv.reader(csvfile)
# for row in reader:
# print(row)
input_state = GPIO.input(21)
if input_state == False:
print("button pressed")
# os.system('python /home/pi/Desktop/switch/matrix_led.py')
time.sleep(0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment