// ELEC 494 Mechx DK LED GPIO Intro
//Program: LEDgpio1.c
#include <stdio.h>
#include <wiringPi.h>
// Need wiringPi.h include file for specific instructions for GPIO
int
main(
){
int
i;
wiringPiSetup();
// Sets up the I/O pins and instructions for wiringPi
// Attach my LED and its resistor (diagram is provided
// in your Fritzing wiring Diagram
//Use GPIO 0 pin 11 to turn on and off LED
// Set up my GPIO connector pin 11 to be an OUTPUT
pinMode(0,OUTPUT);
digitalWrite(0,HIGH);
//Turn ON GPIO to 3.3V or HIGH voltage
for
(i=1;i<1000; ++i)
{
//waiting or delay function
}
digitalWrite(0,LOW);
// Turn OFF LED
delay(2000);
// delay 2000 ms
digitalWrite(0,HIGH);
delay(5000);
// delay by 5000 ms
digitalWrite(0,LOW);
printf
(
"\n\n I'm done! All pau! \n\n"
);
}
No comments:
Post a Comment