Änderungen

Aus Linkerkit.de

Wechseln zu: Navigation, Suche

LK-Poti

596 Byte hinzugefügt, 16:09, 19. Okt. 2016
/* Codebeispiel Raspberry */
==Codebeispiel Raspberry==
 <pre class="brush:py">import RPi.GPIO as GPIOimport spidevfrom time import sleep # Initialisiere Potentiometer auf Analogen-PIN 0 und LED auf Digitalen PIN 4temp = 0led = 4 spi = spidev.SpiDev()spi.open(0,0)GPIO.setwarnings(False)GPIO.setmode(GPIO.BCM)GPIO.setup(led, GPIO.OUT) def readadc(adcnum):# SPI-Daten auslesenr = spi.xfer2([1,8+adcnum <<4,0])adcout = ((r[1] &3) <<8)+r[2]return adcout while True: value = readadc(temp) print("Value: " + str(value))  if(value > 500): GPIO.output(led, True) else: GPIO.output(led, False) sleep(0.5) </pre> 
==Downloads==
Infos:<br />Englisch: [[Medium:001267857-da-01-en-LINKER_KIT_PLATINE_MIT_DREHPOTENTIOMETER.pdf|001267857-da-01-en-LINKER_KIT_PLATINE_MIT_DREHPOTENTIOMETER.pdf]]
Schaltung: [[Medium:001267857-sp-01-en-LINKER_KIT_PLATINE_MIT_DREHPOTENTIOMETER.pdf|001267857-sp-01-en-LINKER_KIT_PLATINE_MIT_DREHPOTENTIOMETER.pdf]]