Example using single button touch sensor
Dependencies: mbed
Fork of Seeed_Grove_Slider_Potentiometer_Example by
main.cpp@1:401629079a98, 2014-08-15 (annotated)
- Committer:
- sam_grove
- Date:
- Fri Aug 15 15:51:55 2014 +0000
- Revision:
- 1:401629079a98
- Parent:
- 0:46e460c85e27
- Child:
- 2:9b9cc4e82355
Add LED to the example. Making it more comprehensive
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 0:46e460c85e27 | 1 | |
sam_grove | 0:46e460c85e27 | 2 | #include "mbed.h" |
sam_grove | 0:46e460c85e27 | 3 | |
sam_grove | 0:46e460c85e27 | 4 | AnalogIn pot(A0); |
sam_grove | 1:401629079a98 | 5 | DigitalOut led(A1); |
sam_grove | 0:46e460c85e27 | 6 | |
sam_grove | 0:46e460c85e27 | 7 | int main (void) |
sam_grove | 0:46e460c85e27 | 8 | { |
sam_grove | 0:46e460c85e27 | 9 | float value = 0.0f; |
sam_grove | 0:46e460c85e27 | 10 | |
sam_grove | 0:46e460c85e27 | 11 | while(1) { |
sam_grove | 0:46e460c85e27 | 12 | value = pot; |
sam_grove | 0:46e460c85e27 | 13 | printf("Slide location %3.2f\n", value); |
sam_grove | 0:46e460c85e27 | 14 | wait(0.5f); |
sam_grove | 1:401629079a98 | 15 | led = !led; |
sam_grove | 0:46e460c85e27 | 16 | } |
sam_grove | 0:46e460c85e27 | 17 | } |