Académique Documents
Professionnel Documents
Culture Documents
org/resources
LED
led.on()
led.blink()
_
led.on()
+ _ a b c d e f g h i j +
USB X2 1 1
2 2
led.off()
GP2
3
4
3
4 from gpiozero import RGBLED
led = RGBLED(red=2, green=3, blue=4)
5 5
GP3 GND
led.color = (r, g, b)
6 6
GP4 7 7
8
9
8
9
r, g, b = 0, 0, 1
led.color = (r, g, b)
10 10
11
12
11
12 led.red = 1
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
Motor
23 23
24 24
25 25
21 21
22 22
GPIO 23 23
24 24
motor.forward()
25 25
+ _ a b c d e f g h i j + _
USB X2
motor.reverse()
Button
+ _ from +gpiozero
_ import Button button.wait_for_press()
a b c d e f g h i
j
if pir.motion_detected:
23 23
pir.when_motion = motor.forward
24 24
_ print("You moved")
25 25
+ _ a b c d e f g h i j +
pir.when_no_motion = motor.backward