diff --git a/analogSensor.py b/analogSensor.py index 0050a9d..a9b9139 100644 --- a/analogSensor.py +++ b/analogSensor.py @@ -1,10 +1,24 @@ from gpiozero import MCP3008 from time import sleep -#remember to enable SPI in raspi-config > interfaces before you run this the first time + ################## +# Before you start # +################## +# remember to enable SPI in raspi-config > interfaces before you run this the first time +# see method one here: https://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/ -#How to wire the MCP3008: https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008 -#gpiozero documentation about MCP3008: https://gpiozero.readthedocs.io/en/stable/api_spi.html + ################# +# Wiring MCP3008 # +################ +# https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008 +# gpiozero documentation about MCP3008: https://gpiozero.readthedocs.io/en/stable/api_spi.html + + ################# +# Wiring sensors # +################# +# This code assumes you have an LDR on channel 0 of the mcp3008 +# You can wire one up like so: https://maker.pro/raspberry-pi/tutorial/how-to-read-an-ldr-sensor-with-raspberry-pi-using-mcp3008 +# However, you could use any other analog sensor (up to eight) ldr = MCP3008(channel=0, device=0)