ESE519 / Mbed 2 deprecated Part0_version2

Dependencies:   mbed

main.cpp

Committer:
jaredwil
Date:
2015-01-29
Revision:
0:de7d01936df5
Child:
1:dbcb74ecd5b0

File content as of revision 0:de7d01936df5:

#include "mbed.h"
#include "math.h"

Serial pc(USBTX, USBRX);

DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
Timer timer;


int main() {
        srand(time(NULL));
        int a = (rand()%3);
        int b = (rand()%3);
        int c = (rand()%3);
        int d = (rand()%3);
        int e = (rand()%3);
        int f = (rand()%3);
        int g = (rand()%3);
        int h = (rand()%3);
        int i = (rand()%3);
        int i = (rand()%3);
        int j = (rand()%3);

        
        int pattern[10] = {a,b,c,d,e,f,g,h,i,j};
        
        
        pc.printf("A: %f, %f, %f",a,b,c);

    while(1) {
        
        timer.start();
        while(timer.read() < 18){
            for(int i = 0; i < 10; i+= 1){
                switch(pattern[i])
                    {
                        case 0:
                        myled1 = 1;
                        wait(1.8);
                        myled1 = 0;
                        break;
                        case 1:
                        myled2 = 1;
                        wait(1.8);
                        myled2 = 0;
                        break;
                        case 2:
                        myled3 = 1;
                        wait(1.8);
                        myled3 = 0;
                        break;
                    }
 
                }
           }
           
        timer.reset();

        }
}