pinout.vvzero.com/src/fr/overlay/traffic-hat.md

53 lines
937 B
Markdown
Raw Normal View History

<!--
---
name: Traffic HAT
2016-07-27 19:17:56 +08:00
class: board
type: tous
manufacturer: Ryanteck LTD.
url: http://www.ryanteck.uk/store/traffichat
buy: http://www.ryanteck.uk/store/traffichat
2015-11-16 07:46:58 +08:00
description: carte multi-usage avec buzzer, LED et bouton
pincount: 40
pin:
'15':
2015-11-16 07:46:58 +08:00
name: LED1 / vert
direction: output
active: high
'16':
2015-11-16 07:46:58 +08:00
name: LED2 / orange
direction: output
active: high
'18':
2015-11-16 07:46:58 +08:00
name: LED3 / rouge
direction: output
active: high
'22':
2015-11-16 07:46:58 +08:00
name: bouton
direction: input
active: high
'29':
2015-11-16 07:46:58 +08:00
name: buzzer
direction: output
active: high
-->
#Traffic HAT
2015-11-16 07:46:58 +08:00
###Contrôler les broches GPIO du Traffic HAT depuis votre Raspberry Pi est aisé:
```python
2015-11-16 07:46:58 +08:00
import RPi.GPIO as GPIO
from time import sleep
2015-11-16 07:46:58 +08:00
GPIO.setmode(GPIO.BCM)
2015-11-16 07:46:58 +08:00
#LEDs
GPIO.setup(22,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
#Buzzer
2015-11-16 07:46:58 +08:00
GPIO.setup(5,GPIO.OUT)
2015-11-16 07:46:58 +08:00
#Bouton
GPIO.setup(25,GPIO.IN,pull_up_down=GPIO.PUD_UP)
```