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
main.cpp
- Committer:
- Adrianmo
- Date:
- 2018-03-20
- Revision:
- 1:75ac3c939eda
- Parent:
- 0:dd1c4e4ab982
File content as of revision 1:75ac3c939eda:
#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 oppned[2] = {p17, p18}; // Knapper
DigitalIn knapp[2] = {p19, p20};
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)
{
for(int i = 0; i <2 ; i++){
if(oppned[i] == 1){
switch(i)// 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;
{
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;
}
{
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;
}
}
}
}