Todd Dale
/
Serial_Comms_Receive
UART array transmission test code. (Receive)
main.cpp@2:6f9b37d8b6aa, 2018-05-25 (annotated)
- Committer:
- el15tcd
- Date:
- Fri May 25 20:33:16 2018 +0000
- Revision:
- 2:6f9b37d8b6aa
- Parent:
- 1:adb918553885
UART array transmission test code. (Receive)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el15tcd | 0:c16e741bd863 | 1 | #include "mbed.h" |
el15tcd | 0:c16e741bd863 | 2 | |
el15tcd | 0:c16e741bd863 | 3 | Serial device2(p9,p10); //tx,rx |
el15tcd | 0:c16e741bd863 | 4 | BusOut myleds(LED4, LED3, LED2, LED1); |
el15tcd | 0:c16e741bd863 | 5 | |
el15tcd | 2:6f9b37d8b6aa | 6 | DigitalOut scope(p21); |
el15tcd | 2:6f9b37d8b6aa | 7 | |
el15tcd | 2:6f9b37d8b6aa | 8 | char buffer2[4]; |
el15tcd | 0:c16e741bd863 | 9 | int temp2; |
el15tcd | 0:c16e741bd863 | 10 | |
el15tcd | 2:6f9b37d8b6aa | 11 | char matrix2[144][96]; |
el15tcd | 2:6f9b37d8b6aa | 12 | char sensorData[36][48]; |
el15tcd | 2:6f9b37d8b6aa | 13 | char buttonTest[2][2]; |
el15tcd | 1:adb918553885 | 14 | |
el15tcd | 0:c16e741bd863 | 15 | int led1; |
el15tcd | 0:c16e741bd863 | 16 | int led2; |
el15tcd | 0:c16e741bd863 | 17 | int led3; |
el15tcd | 0:c16e741bd863 | 18 | int led4; |
el15tcd | 0:c16e741bd863 | 19 | |
el15tcd | 0:c16e741bd863 | 20 | int main() |
el15tcd | 0:c16e741bd863 | 21 | { |
el15tcd | 0:c16e741bd863 | 22 | |
el15tcd | 0:c16e741bd863 | 23 | myleds = 0; |
el15tcd | 0:c16e741bd863 | 24 | |
el15tcd | 2:6f9b37d8b6aa | 25 | device2.baud(115200); |
el15tcd | 0:c16e741bd863 | 26 | |
el15tcd | 0:c16e741bd863 | 27 | while(1) { |
el15tcd | 2:6f9b37d8b6aa | 28 | |
el15tcd | 2:6f9b37d8b6aa | 29 | led2 = !led2; |
el15tcd | 0:c16e741bd863 | 30 | temp2 = device2.getc(); |
el15tcd | 0:c16e741bd863 | 31 | if (temp2 == 1) { |
el15tcd | 2:6f9b37d8b6aa | 32 | for (int j=0; j<36; j++) { |
el15tcd | 2:6f9b37d8b6aa | 33 | for (int i=0; i<48; i++) { |
el15tcd | 0:c16e741bd863 | 34 | |
el15tcd | 2:6f9b37d8b6aa | 35 | sensorData[i][j] = device2.getc(); |
el15tcd | 1:adb918553885 | 36 | |
el15tcd | 0:c16e741bd863 | 37 | } |
el15tcd | 0:c16e741bd863 | 38 | } |
el15tcd | 2:6f9b37d8b6aa | 39 | scope = !scope; |
el15tcd | 2:6f9b37d8b6aa | 40 | led1 = !led1; |
el15tcd | 2:6f9b37d8b6aa | 41 | temp2 = 0; |
el15tcd | 0:c16e741bd863 | 42 | } |
el15tcd | 0:c16e741bd863 | 43 | } |
el15tcd | 2:6f9b37d8b6aa | 44 | } |