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
Diff: main.cpp
- Revision:
- 0:dd1c4e4ab982
- Child:
- 1:75ac3c939eda
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Mar 20 10:52:26 2018 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+#include <iostream>
+using namespace std;
+
+DigitalOut myled(LED1);
+DigitalOut b[10] = {p21, p22, p23, p24, p25, p26, p27, p28, p29, p30}; // Bargraph
+DigitalIn knapp[4] = {p17, p18, p19, p20}; // Knapper
+Serial pc(USBTX, USBRX);
+
+
+
+int main()
+{
+ pc.printf("For spill 1 tast 1:\n\t");// Valg meny.
+ pc.printf("For spill 2 tast 2:\n\t");
+ pc.printf("For spill 3 tast 3:\n\t");
+
+
+
+
+
+ while(1)
+
+
+
+
+ {
+ switch(pc.getc())// tall fra bruker blir til case
+ {
+ case '1':
+ {
+ for( int a = 0; a < 10; a = a + 1 ) {
+ cout << "value of a: " << a << endl;
+ b[a] = 1;
+
+ wait(0.5);
+ b[a] = 0;
+ }
+ break;
+ }
+ {
+ case '2':
+
+ for( int a = 10; a > -1; a = a - 1 ) {
+ cout << "value of a: " << a << endl;
+ b[a] = 1;
+
+ wait(0.5);
+ b[a] = 0;
+ }
+
+ break;
+ }
+
+ }
+
+ }
+
+}
\ No newline at end of file