Maria Monem
/
ME21001_Lab04_Exercise_03
Ex 3
main.cpp
- Committer:
- mazmonem
- Date:
- 2017-10-09
- Revision:
- 1:0dafa64a6494
- Parent:
- 0:2e3f58a3a6ac
File content as of revision 1:0dafa64a6494:
/****************************************************** /ME21001 Group 1-10 / /Lab 04: Exercise 2 / /This program read the the value of the potnetiometer /and turns on LED#1 if the value is HIGH. / /******************************************************/ #include "mbed.h" DigitalIn potentiometer(p17); // digital input variable declaration DigitalOut led(LED1);// digital output variable declaration int main(){ while(1) { //repeats indefinitely if (potentiometer.read()) { //if the value of the potentiometer is HIGH led = 1; //turn LED#1 on } else { //otherwise led = 0; //turn LED#1 off } } }