Instructions
Linker Kit Base Set Raspberry Pi
Veröffentlicht: 09.10.2018 Copyright by Maker Factory 19
7. DER LICHTSENSOR
Beispielcode fortgeführt.
Führen Sie den Beispielcode mit folgenden Befehlen im Terminal aus:
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--clear', acon='store_true', help='clear the display on exit')
args = parser.parse_args()
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS,
LED_CHANNEL)
strip.begin()
while True:
value = readadc(SENSOR)
print("Value: " + str(value))
me.sleep(0.5)
if int(value) < int(500):
print ("Licht an")
colorWipe(strip, Color(255, 0, 0), 50)
else:
print ("Licht aus")
colorWipe(strip, Color(0, 0, 0), 50)
cd /rpi_ws281x/python/examples
sudo python Lichtsensor.py