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
Fork of ponglevering by
main.cpp
- Committer:
- Adrianmo
- Date:
- 2018-04-10
- Revision:
- 0:31100e2cc464
- Child:
- 1:b179267654bb
File content as of revision 0:31100e2cc464:
#include "mbed.h"
#include <iostream>
using namespace std;
DigitalOut myled(LED1);
DigitalOut b[5] = {p26, p27, p28, p29, p30}; // Bargraph
DigitalOut c[4] = {p21, p22, p23, p24}; // bargraph sone
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 = 5; a > -1; a = a-- ) {
cout << "value of a1: " << a << endl;
cout << "value of c1: " << c[1] << endl;
cout << "value of c12: " << c[2] << endl;
b[a] = 1;
c[0] = 0;
c[1] = 1;
wait(0.5);
b[a] = 0;
}
break;
{
case '2':
for( int a = 5; a > -1; a = a-- ) {
cout << "value of a2: " << a << endl;
cout << "value of c2: " << c << endl;
b[a] = 1;
c[0] = 1;
c[1] = 0;
wait(0.5);
b[a] = 0;
}
break;
}
}
}
}
