Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of IPI_Singapore_Workshop by
Revision 2:10f92fa42985, committed 2017-11-22
- Comitter:
- alansim
- Date:
- Wed Nov 22 07:59:57 2017 +0000
- Parent:
- 1:2792d77cc2cc
- Commit message:
- Revision Commit
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2792d77cc2cc -r 10f92fa42985 main.cpp
--- a/main.cpp Wed Nov 15 08:26:34 2017 +0000
+++ b/main.cpp Wed Nov 22 07:59:57 2017 +0000
@@ -15,10 +15,25 @@
#include "mbed.h"
// GLOBAL VARIABLES HERE
+AnalogIn pot1(A0);
+EventQueue queue;
// FUNCTION DEFINITIONS HERE
+void read_potentiometer() {
+ static float potentiometer_val = 0;
+ if ((float)pot1 != potentiometer_val) {
+ potentiometer_val = (float)pot1;
+ printf("Analog Reading: %.2f\r\n", potentiometer_val);
+ }
+ }
+
int main()
{
// MAIN CODE HERE
+ queue.call_every(100, read_potentiometer);
+ while(1){
+ wait_ms(100);
+ queue.dispatch(0);
+ }
}
\ No newline at end of file
