Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include "gpio_lib.h"
- #define PB09 SUNXI_GPB(9)
- int main()
- {
- int value;
- if(SETUP_OK!=sunxi_gpio_init()){
- printf("Failed to initialize GPIO\n");
- return -1;
- }
- if(SETUP_OK!=sunxi_gpio_set_cfgpin(PB09,INPUT)){
- printf("Failed to config GPIO pin\n");
- return -1;
- }
- while(1)
- {
- value = sunxi_gpio_input(PB09);
- printf("value: %i\n", value);
- usleep(50000);
- }
- sunxi_gpio_cleanup();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement