Sends compass and accelerometer data, receives data and displays on LED matrix
Revision 4:7f5e478f945c, committed 2017-02-20
- Comitter:
- kinga
- Date:
- Mon Feb 20 15:29:07 2017 +0000
- Parent:
- 3:5567512e8de7
- Child:
- 5:191cc309fe86
- Commit message:
- deleted comments
Changed in this revision
--- a/LedMatrix.cpp Mon Feb 20 15:26:27 2017 +0000 +++ b/LedMatrix.cpp Mon Feb 20 15:29:07 2017 +0000 @@ -2,7 +2,6 @@ LedMatrix::LedMatrix() { - //ledMatrix = vector<vector<int> >(5, vector<int>(5, 0)); for (int i = 0; i < 5; ++i) { vector<int> temp; @@ -15,14 +14,6 @@ } } -/*void LedMatrix::setLedMatrix(ManagedString data) -{ - int row, col; - row = (int)data.charAt(0); - col = (int)data.charAt(1); - ledMatrix[row][col] == 0 ? ledMatrix[row][col] = 1 : ledMatrix[row][col] = 0; -}*/ - void LedMatrix::setLedMatrix(int row, int col) { ledMatrix[row][col] = ledMatrix[row][col] == 0 ? 1 : 0;
--- a/LedMatrix.h Mon Feb 20 15:26:27 2017 +0000 +++ b/LedMatrix.h Mon Feb 20 15:29:07 2017 +0000 @@ -10,7 +10,6 @@ vector<vector<int> > ledMatrix; public: LedMatrix(); - //void setLedMatrix(ManagedString data); void setLedMatrix(int row, int col); MicroBitImage getMatrixImage(); };
--- a/main.cpp Mon Feb 20 15:26:27 2017 +0000 +++ b/main.cpp Mon Feb 20 15:29:07 2017 +0000 @@ -37,41 +37,23 @@ return serial.read(2, ASYNC); } -/*int convertData() -{ - return atoi(readData()); -}*/ - -/*void readData() -{ - uBit.display.print(serial.read(ASYNC)); -}*/ - void sendData() { serial.send(getMessage(), ASYNC); -} - +} int main() { uBit.init(); LedMatrix myLedMatrix; - //ManagedString buffer = ""; while(1) { - //const char* temp = readData(); - //temp = readData(); - //buffer = readData(); - //myLedMatrix.setLedMatrix(temp / 10, temp % 10); - //int buffer = readData(); ManagedString buffer = readData(); if (buffer.length() != 0) { myLedMatrix.setLedMatrix((int)buffer.charAt(0) - 48, (int)buffer.charAt(1) - 48); uBit.display.print(myLedMatrix.getMatrixImage()); } - //readData(); sendData(); uBit.sleep(500); }