Sander Straatjes
/
WriteBus
Simple straight forward program to write 16 digital pins and read 8 digital pins through UART
main.cpp@0:b8914565f0af, 2010-12-10 (annotated)
- Committer:
- Sander
- Date:
- Fri Dec 10 09:10:19 2010 +0000
- Revision:
- 0:b8914565f0af
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sander | 0:b8914565f0af | 1 | #include "mbed.h" |
Sander | 0:b8914565f0af | 2 | |
Sander | 0:b8914565f0af | 3 | BusOut myled(LED1, LED2, LED3, LED4); |
Sander | 0:b8914565f0af | 4 | BusOut Dout(p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20); |
Sander | 0:b8914565f0af | 5 | BusIn Din(p21,p22,p23,p24,p25,p26,p27,p28,p29,p30); |
Sander | 0:b8914565f0af | 6 | |
Sander | 0:b8914565f0af | 7 | int main() { |
Sander | 0:b8914565f0af | 8 | unsigned long DataIn=0; |
Sander | 0:b8914565f0af | 9 | while(1) { |
Sander | 0:b8914565f0af | 10 | unsigned long SetValue; |
Sander | 0:b8914565f0af | 11 | scanf("%u", &SetValue); |
Sander | 0:b8914565f0af | 12 | DataIn = Din; |
Sander | 0:b8914565f0af | 13 | printf("%u\t%u\n", DataIn, SetValue); |
Sander | 0:b8914565f0af | 14 | myled = SetValue; |
Sander | 0:b8914565f0af | 15 | Dout = SetValue; |
Sander | 0:b8914565f0af | 16 | } |
Sander | 0:b8914565f0af | 17 | } |