The 3rd of 5 simple mbed demonstration projects. Provides the same functionality as my analogRead project, but uses = and float operator overloads to make code more transparent.
Diff: main.cpp
- Revision:
- 1:4647b43d61ef
- Parent:
- 0:8ed2f4a2a2fe
- Child:
- 2:7448a1637704
--- a/main.cpp Mon Mar 27 12:49:02 2017 +0000 +++ b/main.cpp Mon Mar 27 14:29:20 2017 +0000 @@ -5,7 +5,7 @@ Reads from analog input, streams ASCII text to std serial using printf, and lights onboard LED. Also demonstrates use of floating point literal sufix to eliminate warning and int constants for HIGH and LOW. This version uses - overloaded operators. + overloaded operators and sends LED state read from DigitalOut object. Written by: Dr. C. S. Tritt Created: 3/26/17 (v. 1.0) @@ -34,6 +34,7 @@ else { led = LOW; } + printf("LED = %d\n", (int) led); // Send LED state as serial text. wait(0.25); // 250 ms } }