2015-11-10 02:05:51 +08:00
|
|
|
<!--
|
|
|
|
---
|
|
|
|
name: Raspberry Pi Dots
|
2016-07-27 19:17:56 +08:00
|
|
|
class: board
|
|
|
|
type: alle
|
2016-07-27 20:07:05 +08:00
|
|
|
formfactor: Andere
|
|
|
|
manufacturer: Raspberry Pi
|
|
|
|
image: 'image.png'
|
2015-11-12 04:01:19 +08:00
|
|
|
description: verbinde die Punkte um eine Schaltung zu erstellen
|
2015-11-10 02:05:51 +08:00
|
|
|
url: http://www.raspberrypi.org/dots/
|
|
|
|
github: https://github.com/raspberrypilearning/dots
|
2015-12-04 08:31:02 +08:00
|
|
|
pincount: 40
|
2015-11-10 02:05:51 +08:00
|
|
|
pin:
|
|
|
|
bcm0:
|
2015-11-12 04:01:19 +08:00
|
|
|
name: 'Farbe: Blau'
|
2015-11-10 02:05:51 +08:00
|
|
|
direction: input
|
|
|
|
bcm1:
|
|
|
|
name: Dot 7
|
|
|
|
direction: input
|
|
|
|
bcm2:
|
|
|
|
name: Dot 22
|
|
|
|
direction: input
|
|
|
|
bcm3:
|
|
|
|
name: Dot 21
|
|
|
|
direction: input
|
|
|
|
bcm4:
|
|
|
|
name: Dot 2
|
|
|
|
direction: input
|
|
|
|
bcm5:
|
|
|
|
name: Dot 9
|
|
|
|
direction: input
|
|
|
|
bcm6:
|
|
|
|
name: Dot 14
|
|
|
|
direction: input
|
|
|
|
bcm7:
|
|
|
|
name: Dot 6
|
|
|
|
direction: input
|
|
|
|
bcm8:
|
|
|
|
name: Dot 18
|
|
|
|
direction: input
|
|
|
|
bcm9:
|
|
|
|
name: Dot 17
|
|
|
|
direction: input
|
|
|
|
bcm10:
|
2015-11-12 04:01:19 +08:00
|
|
|
name: 'Farbe: Grün'
|
2015-11-10 02:05:51 +08:00
|
|
|
direction: input
|
|
|
|
bcm11:
|
|
|
|
name: Dot 8
|
|
|
|
direction: input
|
|
|
|
bcm12:
|
|
|
|
name: Dot 10
|
|
|
|
direction: input
|
|
|
|
bcm13:
|
|
|
|
name: Cloud
|
|
|
|
direction: input
|
|
|
|
bcm14:
|
|
|
|
name: Dot 1
|
|
|
|
direction: input
|
|
|
|
bcm15:
|
|
|
|
name: Dot 3
|
|
|
|
direction: input
|
|
|
|
bcm16:
|
|
|
|
name: Dot 13
|
|
|
|
direction: input
|
|
|
|
bcm17:
|
|
|
|
name: Dot 4
|
|
|
|
direction: input
|
|
|
|
bcm18:
|
|
|
|
name: Dot 20
|
|
|
|
direction: input
|
|
|
|
bcm19:
|
2015-11-12 04:01:19 +08:00
|
|
|
name: 'Farbe: Orange'
|
2015-11-10 02:05:51 +08:00
|
|
|
direction: input
|
|
|
|
bcm20:
|
|
|
|
name: Bear
|
|
|
|
direction: input
|
|
|
|
bcm21:
|
|
|
|
name: Dot 12
|
|
|
|
direction: input
|
|
|
|
bcm22:
|
|
|
|
name: Dot 15
|
|
|
|
direction: input
|
|
|
|
bcm23:
|
|
|
|
name: Dot 16
|
|
|
|
direction: input
|
|
|
|
bcm24:
|
|
|
|
name: Dot 19
|
|
|
|
direction: input
|
|
|
|
bcm25:
|
|
|
|
name: Dot 5
|
|
|
|
direction: input
|
|
|
|
bcm26:
|
|
|
|
name: Dot 11
|
|
|
|
direction: input
|
|
|
|
bcm27:
|
2015-11-12 04:01:19 +08:00
|
|
|
name: 'Farbe: Rot'
|
2015-11-10 02:05:51 +08:00
|
|
|
direction: input
|
|
|
|
-->
|
|
|
|
#Raspberry Pi Dots
|
|
|
|
|
2015-11-12 04:01:19 +08:00
|
|
|
###Dots ist eine verbinde die Punkte HAT Platine für den Raspberry Pi, auf dem Du Punkte mit leitender Farbe verbindest!
|
2015-11-10 02:05:51 +08:00
|
|
|
|
2015-11-12 04:01:19 +08:00
|
|
|
Jeder Punkt auf der Dots-Platine ist ein offener Metallkontakt der darauf wartet mit der Farbe kontaktiert zu werden.
|
|
|
|
|
|
|
|
|
|
|
|
Um einen Punkt auszulesen setze den dazugehörigen Anschluss als Eingang und checke, ob der Kontakt hergestellt ist:
|
2015-11-10 02:05:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
import RPi.GPIO as GPIO
|
|
|
|
GPIO.setmode(GPIO.BCM )
|
|
|
|
GPIO.setup(dot_pin, GPIO.IN, GPIO.PUD_UP)
|
|
|
|
state = GPIO.input(dot_pin)
|
|
|
|
```
|
|
|
|
|
2015-11-12 04:01:19 +08:00
|
|
|
Es ist gute Praxis den Eingang nur auf PULLUP zu schalten, wenn Du den Kontakt auch lesen möchtest.
|
|
|
|
Somit ist folgender Code empfohlen:
|
2015-11-10 02:05:51 +08:00
|
|
|
|
|
|
|
```python
|
|
|
|
def is_dot_connected(dot_pin):
|
|
|
|
GPIO.setup(dot_pin, GPIO.IN, GPIO.PUD_UP)
|
|
|
|
state = GPIO.input( dot_pin )
|
|
|
|
GPIO.setup(dot_pin, GPIO.IN, GPIO.PUD_OFF)
|
|
|
|
return state == 0
|
|
|
|
```
|