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:75ac3c939eda, committed 2018-03-20
- Comitter:
- Adrianmo
- Date:
- Tue Mar 20 12:51:25 2018 +0000
- Parent:
- 0:dd1c4e4ab982
- Commit message:
- begynner og se litt mer ut
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r dd1c4e4ab982 -r 75ac3c939eda main.cpp
--- a/main.cpp Tue Mar 20 10:52:26 2018 +0000
+++ b/main.cpp Tue Mar 20 12:51:25 2018 +0000
@@ -4,7 +4,8 @@
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
+DigitalIn oppned[2] = {p17, p18}; // Knapper
+DigitalIn knapp[2] = {p19, p20};
Serial pc(USBTX, USBRX);
@@ -21,11 +22,12 @@
while(1)
-
-
-
- {
- switch(pc.getc())// tall fra bruker blir til case
+ {
+ for(int i = 0; i <2 ; i++){
+
+ if(oppned[i] == 1){
+
+ switch(i)// tall fra bruker blir til case
{
case '1':
{
@@ -35,6 +37,20 @@
wait(0.5);
b[a] = 0;
+
+ {
+ if(a==10 && knapp[1}==1){
+
+ for( int a = 10; a > -1; a-- ) {
+ b[a] = 1;
+
+ wait(0.5);
+ b[a] = 0;
+ }
+ if(a==0 and knapp[2]==1){
+ return i=1;
+ }
+ else;
}
break;
}
@@ -56,4 +72,4 @@
}
-}
\ No newline at end of file
+}
\ No newline at end of file