progamme experience

Dependencies:   mbed RGB_matrix_Panel_modif

main.cpp

Committer:
Mindgyver
Date:
2019-05-24
Revision:
2:7e46a870ebd1
Parent:
1:159b56e19e44
Child:
3:dfa6925e27d0

File content as of revision 2:7e46a870ebd1:

#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
//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);
                }
                BT_E.printf("D");
                matrix.fillScreen(matrix.Color333(0, 0, 0));
                while(1) {
                    // draw some text!
                    /*matrix.setCursor(1, 0);   // start at top left, with one pixel of spacing
                    matrix.setTextSize(1);    // size 1 == 8 pixels high

                    // printff each letter with a rainbow color
                    matrix.setTextColor(matrix.Color333(7,0,0));
                    matrix.putc('1');
                    matrix.setTextColor(matrix.Color333(7,4,0));
                    matrix.putc('6');
                    matrix.setTextColor(matrix.Color333(7,7,0));
                    matrix.putc('x');
                    matrix.setTextColor(matrix.Color333(4,7,0));
                    matrix.putc('3');
                    matrix.setTextColor(matrix.Color333(0,7,0));
                    matrix.putc('2');*/

                    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);
                            }
                        }
                    }
                }
            }
        }
    }
}