Skip to content

Commit b1c7b6a

Browse files
committed
gpio21 test script
1 parent f1b9acb commit b1c7b6a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

test/gpio21_bcm.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/python3
2+
import RPi.GPIO as GPIO
3+
import time
4+
5+
6+
led = 21
7+
stime = 0.5
8+
9+
GPIO.setmode(GPIO.BCM)
10+
11+
print("GPIO.setup led ")
12+
GPIO.setup(led, GPIO.OUT)
13+
14+
15+
while True:
16+
GPIO.output(led, True)
17+
print('led on ')
18+
time.sleep(stime)
19+
GPIO.output(led, False)
20+
print('led off ')
21+
time.sleep(stime)
22+

test/gpio21_bcm_gpiozero.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#from gpiozero.pins.rpigpio import RPiGPIOPin
2+
from gpiozero import LED
3+
from time import sleep
4+
5+
led = LED(21)
6+
7+
while True:
8+
led.on()
9+
sleep(1)
10+
led.off()
11+
sleep(1)
12+

0 commit comments

Comments
 (0)