Upload dreadnought_195.py
Browse files- dreadnought_195.py +23 -0
dreadnought_195.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""DreadNought.195
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colab.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/drive/1mw3Ux6AQwJJzl9ZBnCVlfHtkExsAEZrr
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import RPi.GPIO as GPIO
|
| 11 |
+
import ADC0834
|
| 12 |
+
from time import sleep
|
| 13 |
+
GPIO.setmode(GPIO.BCM)
|
| 14 |
+
ADC0834.setup()
|
| 15 |
+
try:
|
| 16 |
+
while True:
|
| 17 |
+
lightVal=ADC0834.getResult(0)
|
| 18 |
+
print('Light Value:',lightVal)
|
| 19 |
+
sleep(.2)
|
| 20 |
+
except KeyboardInterrupt:
|
| 21 |
+
sleep(.1)
|
| 22 |
+
GPIO.cleanup()
|
| 23 |
+
print('GPIO Ready To Perform')
|