From 8a27c1bc894c37a98da0e917469890a8d8e7ba87 Mon Sep 17 00:00:00 2001 From: LazyAssassin445 Date: Fri, 24 Feb 2017 11:37:20 +0000 Subject: [PATCH] Adding test files --- beamtest | 13 +++++++++++++ spitest | 17 +++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 beamtest create mode 100755 spitest diff --git a/beamtest b/beamtest new file mode 100755 index 0000000..cfd06ec --- /dev/null +++ b/beamtest @@ -0,0 +1,13 @@ +#!/usr/bin/python3 + +import RPi.GPIO as GPIO +import time +import sys + +GPIO.setmode(GPIO.BCM) +GPIO.setup(23, GPIO.IN, GPIO.PUD_UP) + +while True: + print(GPIO.input(23), end="") + sys.stdout.flush() + time.sleep(.1) diff --git a/spitest b/spitest new file mode 100755 index 0000000..090d5f8 --- /dev/null +++ b/spitest @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import spidev +import time +import os + +spi = spidev.SpiDev() +spi.open(0, 0) + +def readchannel(channel): + adc = spi.xfer2([1, (8+channel)<<4, 0]) + data = ((adc[1]&3)<<8) + adc[2] + return data + +while True: + print(readchannel(7)) + time.sleep(.5)