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.
Revision 0:44a93c0dc4a8, committed 2017-09-20
- Comitter:
- mdidrich
- Date:
- Wed Sep 20 05:45:54 2017 +0000
- Commit message:
- oving4-1
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 44a93c0dc4a8 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Sep 20 05:45:54 2017 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+AnalogIn potmeter(p20);
+BusOut bar(p21, p22, p23, p24, p25, p26, p27, p28, p29, p30);
+Serial pc(USBTX, USBRX);
+
+int teller;
+float aIn, v;
+Ticker ticker;
+
+void read()
+{
+ pc.printf("Avlest spenning er %.1f\n", v);
+ pc.printf("Tellerverdien er %d\n", teller);
+}
+
+int main()
+{
+ ticker.attach(&read, 1);
+ while (1) {
+ aIn = potmeter;
+ teller = aIn * 10;
+ v = potmeter*3.3;
+ if(v > 2.0) {
+ led1 = 1;
+ if(v > 3.0) {
+ led2 = 1;
+ }//if
+ else {
+ led2 = 0;
+ }
+ }//if
+ else {
+ led1 = led2 = 0;
+ }
+
+ switch (teller) {
+ case 1:bar = 1;break;
+ case 2:bar = 3;break;
+ case 3:bar = 7;break;
+ case 4:bar = 15;break;
+ case 5:bar = 31;break;
+ case 6:bar = 63;break;
+ case 7:bar = 127;break;
+ case 8:bar = 255;break;
+ case 9:bar = 511;break;
+ case 10:bar = 1023;break;
+ default:bar = 0;break;
+ }//switch
+ }//while
+}//main
+
+
diff -r 000000000000 -r 44a93c0dc4a8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Sep 20 05:45:54 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/675da3299148 \ No newline at end of file