Last active
December 14, 2015 10:48
-
-
Save Leandros/5074276 to your computer and use it in GitHub Desktop.
LED ein- und ausschalten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wiringPi.h> | |
/* | |
* Die PINs der LEDs. Es wird die Pin Bezeichnung von WiringPi genutzt, die hier | |
* (https://projects.drogon.net/raspberry-pi/wiringpi/pins/) nach zu lesen ist. | |
*/ | |
#define LED_1 7 | |
#define LED_2 0 | |
int main() | |
{ | |
// WiringPi wird initialisiert. Dieser schritt ist immer nötig! | |
if (wiringPiSetup() == -1) | |
{ | |
// Falls WiringPi nicht initialisiert werden konnte, wird das Programm beendet. | |
return 1; | |
} | |
// Die GPIOs werden vorbereitet und als Output / Ausgang festgelegt. | |
pinMode(LED_1, OUTPUT); | |
pinMode(LED_2, OUTPUT); | |
// Beide LEDs werden angeschaltet. 1 = an. 0 = aus. | |
digitalWrite(LED_1, 1); | |
digitalWrite(LED_2, 1); | |
// Das programm wird 2s (2000ms) pausiert. | |
delay(2000); | |
// Beide LEDs werden wieder ausgeschaltet. | |
digitalWrite(LED_1, 0); | |
digitalWrite(LED_2, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment