Maria Monem
/
ME21001_Lab04_Exercise_03
Ex 3
main.cpp@0:2e3f58a3a6ac, 2017-10-05 (annotated)
- Committer:
- mazmonem
- Date:
- Thu Oct 05 15:51:17 2017 +0000
- Revision:
- 0:2e3f58a3a6ac
- Child:
- 1:0dafa64a6494
Ex 3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mazmonem | 0:2e3f58a3a6ac | 1 | #include "mbed.h" |
mazmonem | 0:2e3f58a3a6ac | 2 | DigitalIn potentiometer(p17); // digital input variable declaration |
mazmonem | 0:2e3f58a3a6ac | 3 | DigitalOut led(LED1);// digital output variable declaration |
mazmonem | 0:2e3f58a3a6ac | 4 | int main() { |
mazmonem | 0:2e3f58a3a6ac | 5 | while(1) { |
mazmonem | 0:2e3f58a3a6ac | 6 | if (potentiometer.read()) { |
mazmonem | 0:2e3f58a3a6ac | 7 | led = 1; |
mazmonem | 0:2e3f58a3a6ac | 8 | } |
mazmonem | 0:2e3f58a3a6ac | 9 | else { |
mazmonem | 0:2e3f58a3a6ac | 10 | led = 0; |
mazmonem | 0:2e3f58a3a6ac | 11 | } |
mazmonem | 0:2e3f58a3a6ac | 12 | } |
mazmonem | 0:2e3f58a3a6ac | 13 | } |