Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 52 of 52

Thread: Interrupt on teensy 4.0 + Adafruits Neotrellis

  1. #51
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Quote Originally Posted by Moris526 View Post
    It works but from time to time stops receiving from serial until I press again....
    Perhaps your serial code is somehow getting out of sync with the data?

    From only a quick glance at the code, it seems to just grab 6 bytes and use them without any checking whether they really are the intended bytes. If it ever gets out of sync, you'd have a 1 in 6 chance of grabbing the intended bytes. Otherwise, you might grab the pixel colors and mistakenly use them as the X & Y coordinates.

    Normally this sort of communication uses a unique or unlikely byte or sequence of bytes as a header. If the received data doesn't have a proper header, usually some sort of re-sync is done, like discarding bytes until the header is seen.

  2. #52

    Try this with same result

    void loop() {
      if (Serial.available() > 0) {
          v1 =;
          if (v1== 0 ) {
          v2 = 31;
          else {
          v2 =  v1 - 1 ;    
          trellis.setPixelColor(v2 , rgbColor(0,0,0) ); 
          trellis.setPixelColor(v1 , rgbColor(0,100,0) ); 

    I could do things differently but I dont know if is not the same ..

    I could program the light sequence on the teensy.

    I would only use serial once each time to indicate color numbers of lights to loop.

    But then I would have the problem of timing. I whould still need serial to send the clock of the PC soft..

Posting Permissions

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