From 39d8462eaa3a878ef60c39cfe634e7cbb264fd3b Mon Sep 17 00:00:00 2001 From: tilman Date: Sun, 4 Dec 2016 19:32:39 +0100 Subject: [PATCH] s2 --- code/test/ir_test.py | 27 +++++++++++++++++++++++++++ code/test/lightoff.py | 9 +++++++++ code/test/lighton.py | 8 ++++++++ installation.txt | 3 +-- notes.md | 3 ++- 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 code/test/ir_test.py create mode 100644 code/test/lightoff.py create mode 100644 code/test/lighton.py diff --git a/code/test/ir_test.py b/code/test/ir_test.py new file mode 100644 index 0000000..4169671 --- /dev/null +++ b/code/test/ir_test.py @@ -0,0 +1,27 @@ +import RPi.GPIO as GPIO +import time + +# photo sensor on PIN 4 +GPIO.setmode(GPIO.BCM) +GPIO.setup(4, GPIO.IN) + +# LED on PIN 17 +GPIO.setup(17, GPIO.OUT) +GPIO.output(17, GPIO.LOW) + +try: + print('Start IR test') + + while True: + time.sleep(0.25) + if (GPIO.input(4) == GPIO.LOW): + print('LED OFF') + GPIO.output(17, GPIO.LOW) + else: + print('LED ON') + GPIO.output(17, GPIO.HIGH) + +except KeyboardInterrupt: + print('bye') + GPIO.cleanup() + diff --git a/code/test/lightoff.py b/code/test/lightoff.py new file mode 100644 index 0000000..6129c89 --- /dev/null +++ b/code/test/lightoff.py @@ -0,0 +1,9 @@ +import RPi.GPIO as GPIO +import time + +GPIO.setmode(GPIO.BOARD) + +GPIO.setup(11,GPIO.OUT) +GPIO.output(11,GPIO.LOW) + +GPIO.cleanup() diff --git a/code/test/lighton.py b/code/test/lighton.py new file mode 100644 index 0000000..9a33402 --- /dev/null +++ b/code/test/lighton.py @@ -0,0 +1,8 @@ +import RPi.GPIO as GPIO +import time + +GPIO.setmode(GPIO.BOARD) + +GPIO.setup(11,GPIO.OUT) +GPIO.output(11,GPIO.HIGH) + diff --git a/installation.txt b/installation.txt index eb2d9c3..0118124 100644 --- a/installation.txt +++ b/installation.txt @@ -42,7 +42,7 @@ sudo nano /etc/ntp.conf sudo /etc/init.d/ntp restart date -sudo apt install mc moc +sudo apt install lirc zbar-tools mc moc python3 python-rpi.gpio python3-rpi.gpio # PHAT DAC (https://learn.pimoroni.com/tutorial/phat/raspberry-pi-phat-dac-install) curl -sS get.pimoroni.com/phatdac | bash @@ -65,7 +65,6 @@ sudo nano /etc/modprobe.d/alsa-base.conf - -- HERE BE DRAGONS ------------------------------------------------------------ diff --git a/notes.md b/notes.md index 917e081..3d8c292 100644 --- a/notes.md +++ b/notes.md @@ -12,4 +12,5 @@ ## Gehäuse - Schraublöcher für Raspi am Sockel -- Buttons per Acryl-Transfer beschriften? \ No newline at end of file +- Buttons per Acryl-Transfer beschriften? +- Aussparung Indexpunkt Basis vorn \ No newline at end of file