Teensy problem with WS2812B
  • oharding
    member
    Posts: 17
    Joined: Sat Mar 27, 2021 10:09 am

    Teensy problem with WS2812B

    by oharding » Thu Apr 01, 2021 11:09 am

    Hi!

    I can run the test simple-test.ino script on both the teensy 3.2 and 4.0, but the single line serial script won't run. Sometimes it gives me some almost random output and glitches, but mostly, it's just black. I have connected the teensy to a mutual ground with the leds and the computer and the correct row of the script is uncommented also. I tried uncommenting the test and deubg rows in the script, but they gave me only glitches. For some time the leds actually displayed the correct output from madmapper, but it was still flickery. What might be the problem?
  • mad-matt
    garageCube team
    Posts: 1475
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Teensy problem with WS2812B

    by mad-matt » Thu Apr 01, 2021 8:03 pm

    Hi,
    If you uncommented "//#define JUST_TEST_LEDS" and it's still not working, while the simple-test.ino is ok. The only difference I see is in the simple-test.ino, there's a "delay(10);". I doubt that could change anything but you can try the simple-test with this delay commented to see.
    Are you sure the setup "FastLED.addLeds" and the definitions:
    #define NUM_LEDS 500
    #define DATA_PIN 5
    #define CLOCK_PIN 6
    are the same in both sketches ?
    Cheers
    Matt
  • oharding
    member
    Posts: 17
    Joined: Sat Mar 27, 2021 10:09 am

    Re: Teensy problem with WS2812B

    by oharding » Thu Apr 01, 2021 9:03 pm

    Hi,
    If you uncommented "//#define JUST_TEST_LEDS" and it's still not working, while the simple-test.ino is ok. The only difference I see is in the simple-test.ino, there's a "delay(10);". I doubt that could change anything but you can try the simple-test with this delay commented to see.
    Are you sure the setup "FastLED.addLeds" and the definitions:
    #define NUM_LEDS 500
    #define DATA_PIN 5
    #define CLOCK_PIN 6
    are the same in both sketches ?
    Cheers
    Matt
    Yep, the sketches were original, only altered within the lines of the specific leds. I ried the delay and the result is still the same, even with two separate power sources and two separate led strips. Also with teensy 3.2 and 4.0. It seems to leave the only culprit as my computer, but what could be wrong with it? Thank You for the help!
  • mad-matt
    garageCube team
    Posts: 1475
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Teensy problem with WS2812B

    by mad-matt » Fri Apr 02, 2021 2:15 pm

    mmmm.... if you use the "single-line" sketch with "JUST_TEST_LEDS", it should do exactly the same as the other one. It's not even communicating with MadMapper or reading / writing on serial port. You can simplify the code to remove all useless things until you have the same code than the other one.
    Are you using Teensyduino app ? Same process in both cases ?
    I have no idea what your problem is...
  • oharding
    member
    Posts: 17
    Joined: Sat Mar 27, 2021 10:09 am

    Re: Teensy problem with WS2812B

    by oharding » Thu Apr 08, 2021 11:19 am

    mmmm.... if you use the "single-line" sketch with "JUST_TEST_LEDS", it should do exactly the same as the other one. It's not even communicating with MadMapper or reading / writing on serial port. You can simplify the code to remove all useless things until you have the same code than the other one.
    Are you using Teensyduino app ? Same process in both cases ?
    I have no idea what your problem is...
    With further testing I have seen that the output starts only when I first open the serial monitor in arduino IDE. But still it flickers and the response is slow. Although if I set a solid colour, then the flicker disappears.
  • oharding
    member
    Posts: 17
    Joined: Sat Mar 27, 2021 10:09 am

    Re: Teensy problem with WS2812B

    by oharding » Thu Apr 08, 2021 11:28 am

    Also, the just test leds row works, but still only if I open serial monitor. At first, when I upload the script, the leds are just blank or have the output that was there from the last madmapper session. It will run on if I close serial monitor, but nothing will happen unless I open the monitor.
  • oharding
    member
    Posts: 17
    Joined: Sat Mar 27, 2021 10:09 am

    Re: Teensy problem with WS2812B

    by oharding » Thu Apr 08, 2021 12:09 pm

    Update: I found that the serial problem was caused by that Leonardo serial line, fixed that. But still there's awful amount of flickering
  • oharding
    member
    Posts: 17
    Joined: Sat Mar 27, 2021 10:09 am

    Re: Teensy problem with WS2812B

    by oharding » Thu Apr 08, 2021 12:26 pm

    OH MY GOD I SOLVED IT!! If someone has the same issue add (#define FASTLED_ALLOW_INTERRUPTS 0) just before defining FastLED!
  • mad-matt
    garageCube team
    Posts: 1475
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Teensy problem with WS2812B

    by mad-matt » Thu Apr 08, 2021 11:43 pm

    Great that you solved it. I never had to play with this "#define FASTLED_ALLOW_INTERRUPTS 0" but I might not have the same version of FastLED library, that might explain your issues.
    I don't understand the relation between your teensy and "Leonardo serial line"
  • oharding
    member
    Posts: 17
    Joined: Sat Mar 27, 2021 10:09 am

    Re: Teensy problem with WS2812B

    by oharding » Fri Apr 09, 2021 10:30 am

    Great that you solved it. I never had to play with this "#define FASTLED_ALLOW_INTERRUPTS 0" but I might not have the same version of FastLED library, that might explain your issues.
    I don't understand the relation between your teensy and "Leonardo serial line"
    To be honest, me neither, but hey, it works.

Who is online

Users browsing this forum: No registered users and 12 guests