Merge pull request #127 from bennuttall/ledborg

Add GPIO Zero code examples to LedBorg
This commit is contained in:
RM 2016-10-19 13:19:47 +01:00 committed by GitHub
commit 70082c7d36
5 changed files with 108 additions and 101 deletions

View File

@ -37,28 +37,30 @@ pin:
active: high
description: PiBorg Blue LED
-->
#LedBorg
# LedBorg
The PiBorg LedBorg is an ultra-bright RGB LED board for the Raspberry Pi. It has its own driver, so you don't need to drive it manually.
If you want a much, much wider range of colours, though, you can drive it manually using softPwm in WiringPi. The pin assignments for this are as follows:
WiringPi pin 0: Red LED
WiringPi pin 2: Green LED
WiringPi pin 3: Blue LED
This is easy using WiringPi in Python:
The PiBorg LedBorg is an ultra-bright RGB LED board for the Raspberry Pi.
```python
import wiringpi2 as wiringpi
wiringpi.wiringPiSetup()
from gpiozero import LedBorg
from time import sleep
wiringpi.softPwmCreate(0,0,100)
wiringpi.softPwmCreate(2,0,100)
wiringpi.softPwmCreate(3,0,100)
lb = LedBorg()
# Purple!
wiringpi.softPwmWrite(3,100) # Full Blue
wiringpi.softPwmWrite(0,100) # Full Red
wiringpi.softPWMWrite(2,0) # No Green
while True:
r, g, b = 0, 0, 0
for i in range(100):
r = i / 100
lb.value = (r, g, b)
sleep(0.01)
for i in range(100):
g = i / 100
sleep(0.01)
lb.value = (r, g, b)
for i in range(100):
b = i / 100
lb.value = (r, g, b)
sleep(0.01)
```
[GPIO Zero docs](http://gpiozero.readthedocs.io/en/v1.3.1/api_boards.html#ledborg)

View File

@ -28,29 +28,30 @@ pin:
active: alto (encendido)
description: LED Azul PiBorg
-->
###El PiBorg LedBord es una placa con un LED RGB ultra-brillante para la Rasberry Pi.
PiBorg tiene su propio controlador, así que no necesitas controlarlo manualmente.
Si quieres un mucho, mucho mayor rango de colores, puedes controlarlo manualmente utilizando softPwm en WiringPi. Los pines para esto son los siguientes:
WiringPi pin 0: LED Rojo
WiringPi pin 2: LED Verde
WiringPi pin 3: LED Azul
Esto es fácil usando WiringPi en Python:
### PiBorg LedBorg
El LedBorg es una placa con un LED RGB ultra-brillante para la Rasberry Pi.
```python
import wiringpi2 as wiringpi
wiringpi.wiringPiSetup()
from gpiozero import LedBorg
from time import sleep
wiringpi.softPwmCreate(0,0,100)
wiringpi.softPwmCreate(2,0,100)
wiringpi.softPwmCreate(3,0,100)
lb = LedBorg()
# Violeta!
wiringpi.softPwmWrite(3,100) # Azul al máximo
wiringpi.softPwmWrite(0,100) # Rojo al máximo
wiringpi.softPWMWrite(2,0) # No verde
while True:
r, g, b = 0, 0, 0
for i in range(100):
r = i / 100
lb.value = (r, g, b)
sleep(0.01)
for i in range(100):
g = i / 100
sleep(0.01)
lb.value = (r, g, b)
for i in range(100):
b = i / 100
lb.value = (r, g, b)
sleep(0.01)
```
[GPIO Zero docs](http://gpiozero.readthedocs.io/en/v1.3.1/api_boards.html#ledborg)

View File

@ -28,28 +28,30 @@ pin:
active: high
description: LED bleue de la PiBorg
-->
###La carte PiBorg LedBorg ajoute une LED tricolore RGB à votre Raspberry Pi.
### PiBorg LedBorg
La carte LedBorg prend en charge la gestion de la LED. Cependant, si vous désirez contrôler le gamut de couleurs de manière plus précise, vous pouvez vous tourner vers WiringPi et son softPwn.
Pour ce faire, sachez que les broches WiringPi concernées sont les suivantes:
WiringPi broche 0: LED rouge
WiringPi broche 2: LED verte
WiringPi broche 3: LED bleue
Voici un exemple WiringPi sous Python:
La carte PiBorg LedBorg ajoute une LED tricolore RGB à votre Raspberry Pi.
```python
import wiringpi2 as wiringpi
wiringpi.wiringPiSetup()
from gpiozero import LedBorg
from time import sleep
wiringpi.softPwmCreate(0,0,100)
wiringpi.softPwmCreate(2,0,100)
wiringpi.softPwmCreate(3,0,100)
lb = LedBorg()
# Pour du violet:
wiringpi.softPwmWrite(0,100) # max rouge
wiringpi.softPwmWrite(3,100) # max bleu
wiringpi.softPWMWrite(2,0) # pas de vert
```
while True:
r, g, b = 0, 0, 0
for i in range(100):
r = i / 100
lb.value = (r, g, b)
sleep(0.01)
for i in range(100):
g = i / 100
sleep(0.01)
lb.value = (r, g, b)
for i in range(100):
b = i / 100
lb.value = (r, g, b)
sleep(0.01)
```
[GPIO Zero docs](http://gpiozero.readthedocs.io/en/v1.3.1/api_boards.html#ledborg)

View File

@ -28,30 +28,30 @@ pin:
active: high
description: PiBorg LED blu
-->
###Il PiBorg LedBorg è un LED RGB ultra-luminoso per il Raspberry Pi.
PiBorg ha il suo driver, quindi non devi controllarlo manualmente.
Se vuoi una gamma di colori decisamente più ampia tuttavia, puoi controllarlo manualmente
usando softPwm su WiringPi. L'assegnazione dei pin è come segue:
* WiringPi pin 0: LED rosso
* WiringPi pin 2: LED verde
* WiringPi pin 3: LED blu
È facile usando WiringPi con Python:
# PiBorg LedBorg
Il PiBorg LedBorg è un LED RGB ultra-luminoso per il Raspberry Pi.
```python
import wiringpi2 as wiringpi
wiringpi.wiringPiSetup()
from gpiozero import LedBorg
from time import sleep
wiringpi.softPwmCreate(0,0,100)
wiringpi.softPwmCreate(2,0,100)
wiringpi.softPwmCreate(3,0,100)
lb = LedBorg()
# Viola!
wiringpi.softPwmWrite(3,100) # Blu al massimo
wiringpi.softPwmWrite(0,100) # Rosso al massimo
wiringpi.softPWMWrite(2,0) # Verde spento
```
while True:
r, g, b = 0, 0, 0
for i in range(100):
r = i / 100
lb.value = (r, g, b)
sleep(0.01)
for i in range(100):
g = i / 100
sleep(0.01)
lb.value = (r, g, b)
for i in range(100):
b = i / 100
lb.value = (r, g, b)
sleep(0.01)
```
[GPIO Zero docs](http://gpiozero.readthedocs.io/en/v1.3.1/api_boards.html#ledborg)

View File

@ -28,28 +28,30 @@ pin:
active: high
description: PiBorg Blue LED
-->
###PiBorg LedBorg RGB LED Board
# PiBorg LedBorg
[PiBorg LedBorg](http://www.piborg.org/ledborg/), Raspberry Pi için oldukça hafif bir RGB LED board'udur. Bu board kendisine ait bir sürücü barındırır, bu yüzden ayrıca bir sürücü kurmanıza gerek yok.
Eğer daha fazla aralıkta renk istiyorsanız bunu WiringPi ile softPwm ile de yapabilirsiniz. Pin atamaları şu şekilde:
WiringPi pin 0: Kırmızı LED
WiringPi pin 2: Yeşil LED
WiringPi pin 3: Mavi LED
Python ile bunu yapmak neredeyse çocuk oyuncağı:
PiBorg LedBorg, Raspberry Pi için oldukça hafif bir RGB LED board'udur. Bu board kendisine ait bir sürücü barındırır, bu yüzden ayrıca bir sürücü kurmanıza gerek yok.
```python
import wiringpi2 as wiringpi
wiringpi.wiringPiSetup()
from gpiozero import LedBorg
from time import sleep
wiringpi.softPwmCreate(0,0,100)
wiringpi.softPwmCreate(2,0,100)
wiringpi.softPwmCreate(3,0,100)
lb = LedBorg()
# mor!
wiringpi.softPwmWrite(3,100) # Full Blue
wiringpi.softPwmWrite(0,100) # Full Red
wiringpi.softPWMWrite(2,0) # No Green
```
while True:
r, g, b = 0, 0, 0
for i in range(100):
r = i / 100
lb.value = (r, g, b)
sleep(0.01)
for i in range(100):
g = i / 100
sleep(0.01)
lb.value = (r, g, b)
for i in range(100):
b = i / 100
lb.value = (r, g, b)
sleep(0.01)
```
[GPIO Zero docs](http://gpiozero.readthedocs.io/en/v1.3.1/api_boards.html#ledborg)