2015-05-07 08:15:14 +08:00
|
|
|
<!--
|
|
|
|
---
|
|
|
|
name: Traffic HAT
|
2016-07-27 19:17:56 +08:00
|
|
|
class: board
|
2016-10-22 07:10:06 +08:00
|
|
|
type: multi
|
2016-07-27 20:07:05 +08:00
|
|
|
formfactor: HAT
|
|
|
|
manufacturer: Ryanteck
|
2016-07-27 22:15:29 +08:00
|
|
|
description: carte multi-usage avec buzzer, LED et bouton
|
2016-10-27 06:52:01 +08:00
|
|
|
url: https://ryanteck.uk/hats/1-traffichat-0635648607122.html
|
|
|
|
buy: https://ryanteck.uk/hats/1-traffichat-0635648607122.html
|
2016-07-27 22:15:29 +08:00
|
|
|
image: 'traffic-hat.png'
|
2015-05-07 08:15:14 +08:00
|
|
|
pincount: 40
|
2016-07-27 22:15:29 +08:00
|
|
|
eeprom: yes
|
2015-05-07 08:15:14 +08:00
|
|
|
pin:
|
|
|
|
'15':
|
2015-11-16 07:46:58 +08:00
|
|
|
name: LED1 / vert
|
2015-05-07 08:15:14 +08:00
|
|
|
direction: output
|
|
|
|
active: high
|
|
|
|
'16':
|
2015-11-16 07:46:58 +08:00
|
|
|
name: LED2 / orange
|
2015-05-07 08:15:14 +08:00
|
|
|
direction: output
|
|
|
|
active: high
|
|
|
|
'18':
|
2015-11-16 07:46:58 +08:00
|
|
|
name: LED3 / rouge
|
2015-05-07 08:15:14 +08:00
|
|
|
direction: output
|
|
|
|
active: high
|
|
|
|
'22':
|
2015-11-16 07:46:58 +08:00
|
|
|
name: bouton
|
2015-05-07 08:15:14 +08:00
|
|
|
direction: input
|
|
|
|
active: high
|
|
|
|
'29':
|
2015-11-16 07:46:58 +08:00
|
|
|
name: buzzer
|
2015-05-07 08:15:14 +08:00
|
|
|
direction: output
|
|
|
|
active: high
|
|
|
|
-->
|
|
|
|
#Traffic HAT
|
|
|
|
|
2016-10-22 07:10:06 +08:00
|
|
|
###Contrôler les broches GPIO du Traffic HAT depuis votre Raspberry Pi est aisé:
|
2015-11-11 19:35:33 +08:00
|
|
|
|
2015-05-07 08:15:14 +08:00
|
|
|
```python
|
2015-11-16 07:46:58 +08:00
|
|
|
import RPi.GPIO as GPIO
|
2015-05-07 08:15:14 +08:00
|
|
|
from time import sleep
|
|
|
|
|
2015-11-16 07:46:58 +08:00
|
|
|
GPIO.setmode(GPIO.BCM)
|
2015-05-07 08:15:14 +08:00
|
|
|
|
2015-11-16 07:46:58 +08:00
|
|
|
#LEDs
|
|
|
|
GPIO.setup(22,GPIO.OUT)
|
|
|
|
GPIO.setup(23,GPIO.OUT)
|
|
|
|
GPIO.setup(24,GPIO.OUT)
|
2015-05-07 08:15:14 +08:00
|
|
|
|
|
|
|
#Buzzer
|
2015-11-16 07:46:58 +08:00
|
|
|
GPIO.setup(5,GPIO.OUT)
|
2015-05-07 08:15:14 +08:00
|
|
|
|
2015-11-16 07:46:58 +08:00
|
|
|
#Bouton
|
|
|
|
GPIO.setup(25,GPIO.IN,pull_up_down=GPIO.PUD_UP)
|
2016-10-22 07:10:06 +08:00
|
|
|
```
|