![](/media/cache/group/mbed-logo-square-512_3.png.50x50_q85.png)
Additional DigitalIn example
main.cpp@0:10c4d3aa026e, 2017-01-19 (annotated)
- Committer:
- mab5449
- Date:
- Thu Jan 19 14:21:24 2017 -0600
- Revision:
- 0:10c4d3aa026e
Initial commit. Ported code snippets to mbed OS 5 projects
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mab5449 | 0:10c4d3aa026e | 1 | #include "mbed.h" |
mab5449 | 0:10c4d3aa026e | 2 | |
mab5449 | 0:10c4d3aa026e | 3 | DigitalIn a(D0); |
mab5449 | 0:10c4d3aa026e | 4 | DigitalIn b(D1); |
mab5449 | 0:10c4d3aa026e | 5 | DigitalOut z_not(LED1); |
mab5449 | 0:10c4d3aa026e | 6 | DigitalOut z_and(LED2); |
mab5449 | 0:10c4d3aa026e | 7 | DigitalOut z_or(LED3); |
mab5449 | 0:10c4d3aa026e | 8 | DigitalOut z_xor(LED4); |
mab5449 | 0:10c4d3aa026e | 9 | |
mab5449 | 0:10c4d3aa026e | 10 | int main() { |
mab5449 | 0:10c4d3aa026e | 11 | while(1) { |
mab5449 | 0:10c4d3aa026e | 12 | z_not = !a; |
mab5449 | 0:10c4d3aa026e | 13 | z_and = a && b; |
mab5449 | 0:10c4d3aa026e | 14 | z_or = a || b; |
mab5449 | 0:10c4d3aa026e | 15 | z_xor = a ^ b; |
mab5449 | 0:10c4d3aa026e | 16 | } |
mab5449 | 0:10c4d3aa026e | 17 | } |