Änderungen

Aus Linkerkit.de

Wechseln zu: Navigation, Suche

LK-Buzzer

338 Byte hinzugefügt, 17:05, 9. Nov. 2016
/* Codebeispiel für Raspberry */
</div>
==Codebeispiel Arduino==
<pre class="codebrush:cpp">int speakerPin = 9;
int length = 15; // Anzahl der Noten
char notes[] = "ccggaagffeeddc ";
delay(tempo / 2);
}
} </pre> 
==Codebeispiel für Raspberry==
<pre class="brush:py"> import RPi.GPIO as GPIO
from time import sleep
 
buz = 15
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(buz, GPIO.OUT)
 
#Die Tonhoehe kann mit Variation der Wartezeit (sleep) veraendert werden
while True:
GPIO.output(buz, True)
sleep(0.0005)
GPIO.output(buz, False)
sleep(0.0005)
</pre>
==Download==