Sends compass and accelerometer data, receives data and displays on LED matrix
Diff: main.cpp
- Revision:
- 7:e3d1f064894b
- Parent:
- 6:e316416cae08
- Child:
- 8:c0e98b2fc93a
diff -r e316416cae08 -r e3d1f064894b main.cpp --- a/main.cpp Thu Feb 23 15:25:48 2017 +0000 +++ b/main.cpp Thu Feb 23 15:37:20 2017 +0000 @@ -43,15 +43,14 @@ serial.send(getMessage(), ASYNC); } -void switchLedMatrix() +void switchLedMatrix(LedMatrix matrix) { - LedMatrix myLedMatrix; ManagedString buffer = readData(); int offsetToGetInt = 48; if (buffer.length() != 0) { - myLedMatrix.setLedMatrix((int)buffer.charAt(0) - offsetToGetInt, (int)buffer.charAt(1) - offsetToGetInt); - uBit.display.print(myLedMatrix.getMatrixImage()); + matrix.setLedMatrix((int)buffer.charAt(0) - offsetToGetInt, (int)buffer.charAt(1) - offsetToGetInt); + uBit.display.print(matrix.getMatrixImage()); } } @@ -59,9 +58,10 @@ int main() { uBit.init(); + LedMatrix myLedMatrix; while(1) { - switchLedMatrix(); + switchLedMatrix(myLedMatrix); sendData(); uBit.sleep(500); }