Bluetooth testing code, transmitting test arrays to the multiplexing code.

Dependencies:   mbed

Committer:
el15tcd
Date:
Fri May 25 18:30:15 2018 +0000
Revision:
4:310bc5829be9
Parent:
3:324e4d219ab4
Bluetooth testing code, transmitting test arrays to the multiplexing code.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el15tcd 0:8a61e3541a5e 1 #include "mbed.h"
el15tcd 0:8a61e3541a5e 2
el15tcd 2:0c8d0eeed65c 3 DigitalOut led1(LED1);
el15tcd 0:8a61e3541a5e 4
el15tcd 2:0c8d0eeed65c 5 Serial rn42(p9,p10); //TX, RX
el15tcd 2:0c8d0eeed65c 6 Serial pc(USBTX, USBRX);
el15tcd 0:8a61e3541a5e 7
el15tcd 2:0c8d0eeed65c 8 int BT_trigger;
el15tcd 0:8a61e3541a5e 9 int i;
el15tcd 1:c573caf40864 10 int j;
el15tcd 4:310bc5829be9 11 int counter;
el15tcd 0:8a61e3541a5e 12
el15tcd 2:0c8d0eeed65c 13 char redArray[8][8];
el15tcd 4:310bc5829be9 14 char blueArray[8][8];
el15tcd 3:324e4d219ab4 15 char transmit;
el15tcd 3:324e4d219ab4 16 char received;
el15tcd 0:8a61e3541a5e 17
el15tcd 0:8a61e3541a5e 18 int main()
el15tcd 0:8a61e3541a5e 19 {
el15tcd 0:8a61e3541a5e 20
el15tcd 2:0c8d0eeed65c 21 rn42.baud(460800);
el15tcd 4:310bc5829be9 22 led1 = !led1;
el15tcd 2:0c8d0eeed65c 23 wait(0.5);
el15tcd 0:8a61e3541a5e 24
el15tcd 2:0c8d0eeed65c 25 for (i = 0; i < 8; i++) {
el15tcd 4:310bc5829be9 26 for (j = 0; j < 1; j++) {
el15tcd 3:324e4d219ab4 27 redArray[i][j] = 0x33;
el15tcd 2:0c8d0eeed65c 28 }
el15tcd 2:0c8d0eeed65c 29 }
el15tcd 4:310bc5829be9 30
el15tcd 4:310bc5829be9 31 for (i = 0; i < 8; i++) {
el15tcd 4:310bc5829be9 32 for (j = 1; j < 8; j++) {
el15tcd 4:310bc5829be9 33 redArray[i][j] = 0x00;
el15tcd 4:310bc5829be9 34 }
el15tcd 4:310bc5829be9 35 }
el15tcd 4:310bc5829be9 36
el15tcd 4:310bc5829be9 37 for (i = 0; i < 8; i++) {
el15tcd 4:310bc5829be9 38 for (j = 0; j < 1; j++) {
el15tcd 4:310bc5829be9 39 blueArray[i][j] = 0x0F;
el15tcd 4:310bc5829be9 40 }
el15tcd 4:310bc5829be9 41 }
el15tcd 4:310bc5829be9 42
el15tcd 4:310bc5829be9 43 for (i = 0; i < 8; i++) {
el15tcd 4:310bc5829be9 44 for (j = 1; j < 8; j++) {
el15tcd 4:310bc5829be9 45 blueArray[i][j] = 0x00;
el15tcd 4:310bc5829be9 46 }
el15tcd 4:310bc5829be9 47 }
el15tcd 4:310bc5829be9 48
el15tcd 2:0c8d0eeed65c 49 wait(0.1);
el15tcd 4:310bc5829be9 50 //transmit = 0x01;
el15tcd 0:8a61e3541a5e 51
el15tcd 0:8a61e3541a5e 52 while(1) {
el15tcd 4:310bc5829be9 53 //if (counter < 2) {
el15tcd 4:310bc5829be9 54 rn42.putc(0xC0); //C0 isn't a colour so can be used as a start bit to avoid errors
el15tcd 4:310bc5829be9 55 for (i = 0; i < 8; i++) {
el15tcd 4:310bc5829be9 56 for (j = 0; j < 8; j++) {
el15tcd 4:310bc5829be9 57 rn42.putc(blueArray[i][j]);
el15tcd 4:310bc5829be9 58 }
el15tcd 4:310bc5829be9 59 }
el15tcd 4:310bc5829be9 60 wait(0.1);
el15tcd 4:310bc5829be9 61 //}
el15tcd 4:310bc5829be9 62 /*
el15tcd 4:310bc5829be9 63 else {
el15tcd 4:310bc5829be9 64 rn42.putc(0x01);
el15tcd 4:310bc5829be9 65 if (received == 0x00) {
el15tcd 4:310bc5829be9 66 for (i = 0; i < 8; i++) {
el15tcd 4:310bc5829be9 67 for (j = 0; j < 8; j++) {
el15tcd 4:310bc5829be9 68 rn42.putc(blueArray[i][j]);
el15tcd 4:310bc5829be9 69 }
el15tcd 4:310bc5829be9 70 }
el15tcd 1:c573caf40864 71 }
el15tcd 0:8a61e3541a5e 72 }
el15tcd 4:310bc5829be9 73
el15tcd 4:310bc5829be9 74 counter++;
el15tcd 4:310bc5829be9 75 if (counter > 4) {
el15tcd 4:310bc5829be9 76 counter = 0;
el15tcd 4:310bc5829be9 77 }
el15tcd 4:310bc5829be9 78 */
el15tcd 2:0c8d0eeed65c 79
el15tcd 0:8a61e3541a5e 80 }
el15tcd 0:8a61e3541a5e 81
el15tcd 0:8a61e3541a5e 82 }