Comments (4)
Thought of a couple of different ways to send the data from the uC to the PC.
- Send the
x, y, z
before sendingred, green, blue
. The x, y and z range is 0-7, while the red, green, blue range is 0-15. So this would take quite a lot of data that needs to be send, but no mistakes could be made determining to which coordinate the colours belong. - Send a start transmission character and than send
red, green, blue
for all the LEDs. This would reduce the amount of data that needs to be send, but it's easier to make mistakes in determining to which coordinate the colours belong.
Data protocol
The data protocol I have chosen is the first one, since this is easier on the PC side and could be easily extended with, for example 5-bits BAM instead of 4-bits.
Version info
Note: The number of ASCII characters below is the minimal amount of ASCII characters needed for the transmission.
Description | start | version major + minor + patch | end | total |
---|---|---|---|---|
ASCII Characters | 1 | 5 | 1 | 7 |
ASCII Abbreveration | SOH | ASCII numbers and dot | EOT | |
ASCII Hexadecimal | 01 | 04 |
Example SOH
0
.
1
.
1
EOT
.
Optionally, in case the version number uses more than a single digits, it could be like SOH
15
.
8
.
1
EOT
.
Cube LED data
Note: The number of ASCII characters below is the minimal amount of ASCII characters needed for the transmission.
The total column specifies the total number of ASCII characters that would be needed to send the data of the complete LED cube, so the data for 512 LEDs.
Description | start | start of block | x-Coord | y-Coord | z-Coord | red | green | blue | end of block | ... | end | total |
---|---|---|---|---|---|---|---|---|---|---|---|---|
ASCII Characters | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | ... | 1 | 4098 |
ASCII Abbreveration | SOH | STX | 0-7 | 0-7 | 0-7 | 0-F | 0-F | 0-F | ETB | ... | EOT | |
ASCII Hexadecimal | 01 | 02 | 17 | ... | 04 |
from ledcube.
Successfully tested the LedCubeVisualisation_sendVersion
and LedCubeVisualisation_sendRow
functions using the following code
LedCube_setPixel(0, 0, 0, 15, 0, 0);
LedCube_setPixel(0, 1, 0, 14, 0, 1);
LedCube_setPixel(0, 2, 0, 13, 0, 2);
LedCube_setPixel(0, 3, 0, 12, 0, 3);
LedCube_setPixel(0, 4, 0, 11, 0, 4);
LedCube_setPixel(0, 5, 0, 10, 0, 5);
LedCube_setPixel(0, 6, 0, 9, 0, 6);
LedCube_setPixel(0, 7, 0, 8, 0, 7);
LedCube_updateUsingCopy();
LedCubeVisualisation_sendVersion();
LCV_SEND_CHAR('\n');
LedCubeVisualisation_sendRow( 0, 0, pCubeControlData->pCubeDataRead );
output:
SOH``STX
0.1.0ETB``EOT
STX
000F00ETB``STX
010E01ETB``STX
0D0E02ETB``STX
0C0E03ETB``STX
0B0E04ETB``STX
010A05ETB``STX
010906ETB``STX
010807ETB
from ledcube.
uint8_t z, x, y, t;
for(z = 0; z < 8; z++) {
for(x=0;x<8;x+=2) {
LedCube_setPixel(x, 0, z, 0, 7, 15);
LedCube_setPixel(x, 1, z, 1, 6, 14);
LedCube_setPixel(x, 2, z, 2, 5, 13);
LedCube_setPixel(x, 3, z, 3, 4, 12);
LedCube_setPixel(x, 4, z, 4, 3, 11);
LedCube_setPixel(x, 5, z, 5, 2, 10);
LedCube_setPixel(x, 6, z, 6, 1, 9 );
LedCube_setPixel(x, 7, z, 7, 0, 8 );
LedCube_setPixel(x+1, 0, z, 15, 8, 15);
LedCube_setPixel(x+1, 1, z, 14, 9, 14);
LedCube_setPixel(x+1, 2, z, 13, 10, 13);
LedCube_setPixel(x+1, 3, z, 12, 11, 12);
LedCube_setPixel(x+1, 4, z, 11, 12, 11);
LedCube_setPixel(x+1, 5, z, 10, 13, 10);
LedCube_setPixel(x+1, 6, z, 9, 14, 9 );
LedCube_setPixel(x+1, 7, z, 8, 15, 8 );
}
}
LedCube_updateUsingCopy();
LedCubeVisualisation_sendCubeData(pCubeControlData->pCubeDataRead);
This showed the following block for every layer. So this test was succesfull.
SOH
STX
00007FETB``STX
01016EETB``STX
02025DETB``STX
03034CETB``STX
04043BETB``STX
05052AETB``STX
060619ETB``STX
070708ETB
STX
100F8FETB``STX
110E9EETB``STX
120DADETB``STX
130CBCETB``STX
140BCBETB``STX
150ADAETB``STX
1609E9ETB``STX
1708F8ETB
STX
20007FETB``STX
21016EETB``STX
22025DETB``STX
23034CETB``STX
24043BETB``STX
25052AETB``STX
260619ETB``STX
270708ETB
STX
300F8FETB``STX
310E9EETB``STX
320DADETB``STX
330CBCETB``STX
340BCBETB``STX
350ADAETB``STX
3609E9ETB``STX
3708F8ETB
STX
40007FETB``STX
41016EETB``STX
42025DETB``STX
43034CETB``STX
44043BETB``STX
45052AETB``STX
460619ETB``STX
470708ETB
STX
500F8FETB``STX
510E9EETB``STX
520DADETB``STX
530CBCETB``STX
540BCBETB``STX
550ADAETB``STX
5609E9ETB``STX
5708F8ETB
STX
60007FETB``STX
61016EETB``STX
62025DETB``STX
63034CETB``STX
64043BETB``STX
65052AETB``STX
660619ETB``STX
670708ETB
STX
700F8FETB``STX
710E9EETB``STX
720DADETB``STX
730CBCETB``STX
740BCBETB``STX
750ADAETB``STX
7609E9ETB``STX
7708F8ETB
...
EOT
from ledcube.
Removing the last two items from the list in the opening post because those are related to the LedCube Visualisation program, which is currently being rewritten to C++ with Qt by the way.
So this closes this issue.
from ledcube.
Related Issues (14)
- Software FIFO buffer, overflow error
- Doxygen code documentation HOT 2
- License change (MIT to GPLv3) HOT 1
- Convert code to the C99 standard HOT 1
- Standard printf with redirect instead of custom printf HOT 1
- Remove self tests and use unit tests
- Assertion messages keep printing infinitely HOT 1
- Debugging messages HOT 3
- Debugging function call messages with indent
- Switching CubeData buffer
- Delay files
- Controlling a single layer HOT 5
- Initialize ports
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ledcube.