SHOW:
|
|
- or go back to the newest paste.
1 | #include <bcm2835.h> | |
2 | ||
3 | #define IO_PIN RPI_GPIO_P1_11 | |
4 | #define LATCH_PIN RPI_GPIO_P1_13 | |
5 | #define CLOCK_PIN RPI_GPIO_P1_15 | |
6 | ||
7 | int main(int argc, char **argv) | |
8 | { | |
9 | ||
10 | if (!bcm2835_init()) | |
11 | return 1; | |
12 | ||
13 | bcm2835_gpio_fsel(IO_PIN, BCM2835_GPIO_FSEL_OUTP); | |
14 | bcm2835_gpio_fsel(LATCH_PIN, BCM2835_GPIO_FSEL_OUTP); | |
15 | bcm2835_gpio_fsel(CLOCK_PIN, BCM2835_GPIO_FSEL_OUTP); | |
16 | ||
17 | bcm2835_gpio_write(IO_PIN, HIGH); | |
18 | ||
19 | - | bcm2835_gpio_write(IO_PIN, LOW); |
19 | + | |
20 | delay(5); | |
21 | bcm2835_gpio_write(CLOCK_PIN, LOW); | |
22 | delay(5); | |
23 | bcm2835_gpio_write(CLOCK_PIN, HIGH); | |
24 | delay(5); | |
25 | bcm2835_gpio_write(CLOCK_PIN, LOW); | |
26 | delay(5); | |
27 | bcm2835_gpio_write(CLOCK_PIN, HIGH); | |
28 | delay(5); | |
29 | bcm2835_gpio_write(CLOCK_PIN, LOW); | |
30 | delay(5); | |
31 | ||
32 | bcm2835_gpio_write(LATCH_PIN, HIGH); | |
33 | bcm2835_gpio_write(LATCH_PIN, LOW); | |
34 | ||
35 | return 0; | |
36 | } |