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.
Dependencies: mbed
Revision 1:66c794ac87fa, committed 2021-07-13
- Comitter:
- kinii
- Date:
- Tue Jul 13 12:33:57 2021 +0000
- Parent:
- 0:e36fb7e4cd89
- Commit message:
- first commit
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e36fb7e4cd89 -r 66c794ac87fa main.cpp
--- a/main.cpp Thu Jul 01 18:20:29 2021 +0000
+++ b/main.cpp Tue Jul 13 12:33:57 2021 +0000
@@ -1,14 +1,20 @@
#include "mbed.h"
-AnalogIn p1(p19);
+AnalogIn p1(p17); //different pin - i.e. unconnected
AnalogOut o1(p18);
int main() {
while(1) {
- float p1_float = p1; // read pot1 value
- float p1_volts = p1_float * 3.3; // convert analog value to voltage
- printf("float: %f volts: %f \r\n",p1_float, p1_volts);
- wait(1);
-
+ for(int i=0; i<10; i++){
+ printf("for loop i=%d \r\n", i);
+ o1 = i/10; // applying analoginput...
+
+ // physically connect a wire btween p1 and o1
+ wait(1);
+ float p1_float = p1; // read pot1 value
+ float p1_volts = p1_float * 3.3; // convert analog value to voltage
+ printf("float: %f volts: %f \r\n",p1_float, p1_volts);
+ wait(3);
+ }
}
}