progamme experience

Dependencies:   mbed RGB_matrix_Panel_modif

main.cpp

Committer:
Mindgyver
Date:
2019-05-27
Revision:
4:758ce5c1b2fc
Parent:
3:dfa6925e27d0
Child:
5:e429087355fc

File content as of revision 4:758ce5c1b2fc:

#include "mbed.h"
#include "RGBmatrixPanel.h" // Hardware-specific library

/*
//RGBmatrixPanel(r1, g1, b1, r2, g2, b2, a, b, c, sclk, latch, oe, enable double_buffer);
//Config NXP1768 16x32
PinName ub1=p8;
PinName ug1=p7;
PinName ur1=p6;
PinName lb2=p11;
PinName lg2=p10;
PinName lr2=p9;
RGBmatrixPanel matrix(ur1,ug1,ub1,lr2,lg2,lb2,p12,p19,p20,p16,p17,p18,false);
DigitalOut d(p15,0);
*/

//RGBmatrixPanel(r1, g1, b1, r2, g2, b2, a, b, c, d, sclk, latch, oe, enable double_buffer);
//Config NXP1768 32x32


PinName ub1=p8;
PinName ug1=p7;
PinName ur1=p6;
PinName lb2=p11;
PinName lg2=p10;
PinName lr2=p9;
RGBmatrixPanel matrix(ur1,ug1,ub1,lr2,lg2,lb2,p12,p19,p20,p15,p16,p17,p18,false);


/*
//Config ST F303K8
PinName ur1=D2;
PinName ug1=D3;
PinName ub1=D4;
PinName lr2=D5;
PinName lg2=D6;
PinName lb2=D7;
RGBmatrixPanel matrix(ur1,ug1,ub1,lb2,lg2,lr2,A0,A1,A2,D8,A3,D9,false);
*/
Serial BT_PR(p28,p27,115200); // Depart Bluetooth
Serial BT_E(p13,p14,115200); // Depart Bluetooth

DigitalOut depart(p5,0); // Depart filaire

//Serial pc(USBTX,USBRX,115200); // Depart Bluetooth
int main()
{
    wait(1);
    matrix.begin();

    while(1) {
        if(BT_PR.readable()) {         //Réception d'instruction de l'expérience
            if(BT_PR.getc() == 'A') {
                //pc.putc(BT_PR.getc());
                for (int i =0; i<3; i++) { // Clignotement panneau
                    matrix.fillScreen(matrix.Color333(0, 0, 0));
                    wait_ms(500);
                    matrix.fillScreen(matrix.Color333(7, 0, 0));
                    wait_ms(500);
                }

                depart = 1; // départ filaire
                BT_E.printf("D"); // départ bluetooth

                matrix.fillScreen(matrix.Color333(0, 0, 0));
                while(1) {
                    matrix.drawPixel(rand()%32, rand()%32, matrix.Color333(0, 7,0));
                    matrix.drawPixel(rand()%32, rand()%32, matrix.Color333(0, 0, 0));
                    wait_ms(10);
                    matrix.drawPixel(rand()%32, rand()%32, matrix.Color333(7, 0,0));
                    matrix.drawPixel(rand()%32, rand()%32, matrix.Color333(0, 0, 0));
                    wait_ms(10);
                    matrix.drawPixel(rand()%32, rand()%32, matrix.Color333(0, 0,7));
                    matrix.drawPixel(rand()%32, rand()%32, matrix.Color333(0, 0, 0));
                    wait_ms(10);

                    /* for (int j =0; j<=16; j++) { // Clignotement panneau
                         for (int k=0; k<=16; k++) {
                             for (int l =0; l<=16; l++) {
                                 matrix.fillScreen(matrix.Color444(j, k, l));
                                 wait_ms(100);
                                }
                            }
                        }*/
                }
            }
        }
    }
}