Created
July 3, 2013 06:15
-
-
Save ultramcu/5915807 to your computer and use it in GitHub Desktop.
This file contains 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
/*********************** | |
*Author Ultra MCU | |
* Website : http://miiniq.blogspot.com/ | |
* */ | |
#include <bcm2835.h> | |
#include <stdio.h> | |
void main() | |
{ | |
bcm2835_init(); | |
bcm2835_gpio_fsel(RPI_GPIO_P1_11, BCM2835_GPIO_FSEL_OUTP);//set pin 11 output | |
bcm2835_gpio_fsel(RPI_GPIO_P1_15, BCM2835_GPIO_FSEL_INPT);//set pin 15 input | |
bcm2835_gpio_set_pud(RPI_GPIO_P1_15 , BCM2835_GPIO_PUD_UP);//set pull up pin 15 | |
while(1) | |
{ | |
bcm2835_gpio_write(RPI_GPIO_P1_11, HIGH); | |
sleep(1); | |
bcm2835_gpio_write(RPI_GPIO_P1_11, LOW); | |
sleep(1); | |
printf("Read Value %d\r\n",bcm2835_gpio_lev(RPI_GPIO_P1_15)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment