code runs well using CircuitPython, linted

This commit is contained in:
Mikey Sklar 2019-04-02 18:25:14 -06:00
parent 563867f19d
commit e874794564
4 changed files with 27 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,4 @@
# Raspberry_Pi_Power_Control
Code to accompany this tutorial:
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-13-power-control

View file

@ -0,0 +1,23 @@
import time
import board
from digitalio import DigitalInOut, Direction
pir_pin = board.D24
power_pin = board.D23
pir = DigitalInOut(pir_pin)
pir.direction = Direction.INPUT
power = DigitalInOut(power_pin)
power.direction = Direction.OUTPUT
power.value = False
while True:
if pir.value:
print("POWER ON")
power.value = True
time.sleep(20)
print("POWER OFF")
power.value = False
time.sleep(5)
time.sleep(1)