GPIO Programming for Raspberry Pi using C

#include 

int main() {
    wiringPiSetup ();
    pinMode(7, OUTPUT);
    for (short i = 1; i <= 5; i++) {
        digitalWrite(7, HIGH);
        delay(1000);
        digitalWrite(7, LOW);
        delay(1000);
    }
    return 0;
}

Compile and run

g++ ledtest.cpp -o ledtest -lwiringPi
sudo ./ledtest
Advertisements