Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Teensy 3.2 + SD card + Jinx

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    3

    Teensy 3.2 + SD card + Jinx

    Hi All,

    I have checked the forum and can't find any reference to my problem. This is what I have done so far.

    I have successfully connected a teensy 3.2 to an array of 288 leds using the octoWS2811 library. I have had this working correctly using Jinx and Glediator.

    I now want to play a saved image off an SD card using FastLED. My leds are wired in one long string. This is the code I'm using-

    // //reads pattern generated by jinx from sd card and displays it on the leds


    #include <FastLED.h>
    #include <SPI.h>
    #include <SD.h>

    #define NUM_LEDS 288
    #define DATA_PIN 2
    #define CHIPSET NEOPIXEL
    #define CMD_NEW_DATA 1
    #define BAUD_RATE 9600

    File fxdata;
    CRGB leds[NUM_LEDS];


    void setup()


    {
    FastLED.addLeds<CHIPSET, DATA_PIN>(leds, NUM_LEDS);
    Serial.begin(BAUD_RATE);
    while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
    }


    for(int y = 0 ; y < NUM_LEDS ; y++)
    {
    leds[y] = CRGB::Black; // set all leds to black during setup
    }
    FastLED.show();


    if (!SD.begin(3))
    {
    Serial.println("sdcard initialization failed!");
    return;
    }
    Serial.println("sdcard initialization done.");

    // test file open
    fxdata = SD.open("myanim.dat"); // read only
    if (fxdata)
    {
    Serial.println("file open ok");
    fxdata.close();
    }
    }

    int serialGlediator ()
    {
    while (!Serial.available()) {}
    return Serial.read();
    }

    void loop()
    {

    fxdata = SD.open("myanim.dat"); // read only
    if (fxdata)
    {
    Serial.println("file open ok");
    }

    while (fxdata.available())
    {
    fxdata.readBytes((char*)leds, NUM_LEDS*3);
    FastLED.show();
    delay(50); // set the speed of the animation. 20 is appx ~ 500k bauds
    }

    // close the file in order to prevent hanging IO or similar throughout time
    fxdata.close();
    }

    This code plays a file called myanim.dat off the card and works really well.

    My problem is I want to use Jinx to record the file. When I record an output file with jinx using the glediator output option the file format is as follows-

    The first byte is always Hex 01 followed by 864 (3 X 288 leds) bytes of led1 RGB led2 RGB etc, the next display frame starts with Hex 01 again.

    So each display frame starts with Hex 01 then a frame of correct data. So on each frame the data is shifted by one byte this causes the colour bits to change from Red Green Blue very rapidly.

    I have used a Hex editor program to manually edit the Jinx file to verify the above.

    I am more of a hardware person and not good with software, I think there must be a very easy way to modify the Teensy code to read in the SD card code then remove the first byte of each display frame. This is where you guys come in. If anyone can help with this I would be very happy.

    I have emailed the owner of Jinx to ask whey there is a leading Hex 01 and he did not reply. I have read about other people having this issue it causes the display to flash red green blue very quickly.

    This is my first post, thanks guys.

  2. #2
    Junior Member
    Join Date
    Feb 2018
    Posts
    3
    i know this only works for2811 but i tried it with my WS2812B and it donīt work what do i have to do to get it to work?

    how did you make the myanim.dat file in Jinx? i can only record *.jnr and *.jnx Files ... but no *.dat-Files

    Thank you

  3. #3
    Junior Member
    Join Date
    Feb 2018
    Posts
    3
    Quote Originally Posted by weix View Post
    i know this only works for2811 but i tried it with my WS2812B and it donīt work what do i have to do to get it to work?

    how did you make the myanim.dat file in Jinx? i can only record *.jnr and *.jnx Files ... but no *.dat-Files

    Thank you
    Hi Weix, I don't think this thread belongs in the technical section but here goes.

    You need to open Jinx and click on setup then select output devices then click add to add a new output device.

    Where it says device type you want to select glediator then at the bottom of the box click where it says redirect output to file, this should turn blue, next click select this will bring up a save box, type the name that you want to save the file under, click save. Now when you click setup and select start, your animation will be recorded in the file you have just created, when you press stop the file is saved. (all files are saved with the extension .out) all you have to do is rename the file extension to .dat

    Let me know how you get on.

  4. #4
    Junior Member
    Join Date
    Feb 2018
    Posts
    3
    Iīm sorry to wrote this in here! Thank you grezlad! now i have my own *.dat File
    Until now I have not worked so long with these LED strips but I am willing to learn to program them
    I have experience with microcontrollers but that was some years ago. If anyone can help me in coding the above program for WS2812B LED strips it would be very grateful!

  5. #5
    Junior Member
    Join Date
    Feb 2018
    Posts
    3
    Hi Weix, Same here I'm more used to PIC micros. I have been using the above code on a Teensy 3.2 to drive WS2812B strips. I have serial enabled, this means the Teensy sends messages out to the computer. You have to plug the computer into the Teensy and click upload sketch after the sketch has uploaded you click the magnifying glass in the top right of the window, this allows the sketch to run and the computer to receive text.

    I hope this makes sense.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •