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:
- 0:dd1c4e4ab982
- Child:
- 1:75ac3c939eda
File content as of revision 0:dd1c4e4ab982:
#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;
}
}
}
}