Ex 3

Dependencies:   mbed

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?

UserRevisionLine numberNew 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 }