Giter Site home page Giter Site logo

LedCube Visualisation about ledcube HOT 4 CLOSED

jdbruijn avatar jdbruijn commented on August 25, 2024
LedCube Visualisation

from ledcube.

Comments (4)

 avatar commented on August 25, 2024

Thought of a couple of different ways to send the data from the uC to the PC.

  1. Send the x, y, z before sending red, 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.
  2. 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.

 avatar commented on August 25, 2024

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``STX0.1.0ETB``EOT
STX000F00ETB``STX010E01ETB``STX0D0E02ETB``STX0C0E03ETB``STX0B0E04ETB``STX010A05ETB``STX010906ETB``STX010807ETB

from ledcube.

 avatar commented on August 25, 2024
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
STX00007FETB``STX01016EETB``STX02025DETB``STX03034CETB``STX04043BETB``STX05052AETB``STX060619ETB``STX070708ETB
STX100F8FETB``STX110E9EETB``STX120DADETB``STX130CBCETB``STX140BCBETB``STX150ADAETB``STX1609E9ETB``STX1708F8ETB
STX20007FETB``STX21016EETB``STX22025DETB``STX23034CETB``STX24043BETB``STX25052AETB``STX260619ETB``STX270708ETB
STX300F8FETB``STX310E9EETB``STX320DADETB``STX330CBCETB``STX340BCBETB``STX350ADAETB``STX3609E9ETB``STX3708F8ETB
STX40007FETB``STX41016EETB``STX42025DETB``STX43034CETB``STX44043BETB``STX45052AETB``STX460619ETB``STX470708ETB
STX500F8FETB``STX510E9EETB``STX520DADETB``STX530CBCETB``STX540BCBETB``STX550ADAETB``STX5609E9ETB``STX5708F8ETB
STX60007FETB``STX61016EETB``STX62025DETB``STX63034CETB``STX64043BETB``STX65052AETB``STX660619ETB``STX670708ETB
STX700F8FETB``STX710E9EETB``STX720DADETB``STX730CBCETB``STX740BCBETB``STX750ADAETB``STX7609E9ETB``STX7708F8ETB
...
EOT

from ledcube.

 avatar commented on August 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.