Yoji KURODA
/
Mechatro_DigitalIn
Mechatronics example program
main.cpp@1:e450b69e093a, 2017-10-05 (annotated)
- Committer:
- ykuroda
- Date:
- Thu Oct 05 07:45:04 2017 +0000
- Revision:
- 1:e450b69e093a
- Parent:
- 0:fbfdf477cfd1
small update;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ykuroda | 0:fbfdf477cfd1 | 1 | #include "mbed.h" |
ykuroda | 0:fbfdf477cfd1 | 2 | |
ykuroda | 0:fbfdf477cfd1 | 3 | DigitalOut myled(LED1); |
ykuroda | 0:fbfdf477cfd1 | 4 | DigitalIn d0(D0); |
ykuroda | 0:fbfdf477cfd1 | 5 | |
ykuroda | 0:fbfdf477cfd1 | 6 | int main() { |
ykuroda | 0:fbfdf477cfd1 | 7 | while(1) { |
ykuroda | 0:fbfdf477cfd1 | 8 | myled = ~myled; // LED is toggled |
ykuroda | 0:fbfdf477cfd1 | 9 | |
ykuroda | 1:e450b69e093a | 10 | printf("D[%1d]\n",d0.read()); |
ykuroda | 0:fbfdf477cfd1 | 11 | } |
ykuroda | 0:fbfdf477cfd1 | 12 | } |