Oppgave 5.3

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Smashftw
Date:
Tue Oct 03 11:40:12 2017 +0000
Commit message:
Oppgave 5.3

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 76193024dd24 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 03 11:40:12 2017 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+
+BusOut bargraph(p21, p22, p23, p24, p25, p26);
+float map(float x, float x1,float x2, float y1, float y2);
+AnalogIn ai(p20);
+Serial pc(USBTX,USBRX);
+volatile int y;
+
+int main() {
+    while(1) {
+        bargraph = (int) map(ai, 0.0, 1.0, 0.0, 33.0);
+        wait (0.1);
+        pc.printf ("Tallet er:%.1f\n", map(ai, 0.0, 1.0, 0.0, 33.0) );
+        
+    } 
+}
+float map(float x, float x1,float x2, float y1, float y2){
+     float y = y1 + (x - x1)* (y2-y1) / (x2 -x1);
+     return y;
+     }
\ No newline at end of file
diff -r 000000000000 -r 76193024dd24 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 03 11:40:12 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/235179ab3f27
\ No newline at end of file