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

Thread: midi to dmx on teensy 3.5

  1. #1
    Junior Member
    Join Date
    Aug 2018
    Posts
    8

    midi to dmx on teensy 3.5

    iím trying to build a fast, jitter-free MIDI to DMX box. i made one following this: https://imgur.com/a/vhwt9
    and it works, but itís a bit laggy.

    since i had a teensy 3.5 laying around, i thought iíd give it a go, and when i tried a basic midi receive example program:

    Code:
    int ledPin = 13;
    
    void OnNoteOn(byte channel, byte note, byte velocity) {
      digitalWrite(ledPin, HIGH); // Any Note-On turns on LED
    }
    
    void OnNoteOff(byte channel, byte note, byte velocity) {
      digitalWrite(ledPin, LOW);  // Any Note-Off turns off LED
    }
    
    void setup() {
      pinMode(ledPin, OUTPUT);
      usbMIDI.setHandleNoteOff(OnNoteOff);
      usbMIDI.setHandleNoteOn(OnNoteOn);
      digitalWrite(ledPin, HIGH);
      delay(400);                 // Blink LED once at startup
      digitalWrite(ledPin, LOW);
    }
    
    void loop() {
      usbMIDI.read(5);
    }
    it proved to be way more responsive, at least visually (LED flashing).

    iím a newbie and iím struggling to get the hang of Shawn Silvermanís examples in the TeensyDMX library. i wanted to use midi noteOn data from the example above be sent to one DMX channel, which seems rather simple, but i insist: iím a total noob, so not so easy for me.

    if anybody could give me any pointers on how to do this, perhaps using the basic send example in the TeensyDMX library (see code below), as i assume is the most basic one? BUT equally important, i need some pointers on hardware, cause i may have missed the info in the library files, and this may be a very silly question, but: how do i make these DMX messages go out via a DMX/XLR cable from my Teensy 3.5??? i read it goes over serial pins, but any example diagrams out there?

    MANY MANY THANKS!!!

    Code:
    /*
     * A basic toy send example.
     *
     * (c) 2019 Shawn Silverman
     */
    
    #include <TeensyDMX.h>
    
    namespace teensydmx = ::qindesign::teensydmx;
    
    // Pin for enabling or disabling the transmitter.
    constexpr uint8_t kTXPin = 17;
    
    // Create the DMX sender on Serial1.
    teensydmx::Sender dmxTx{Serial1};
    
    // Data for 3 channels.
    uint8_t data[3]{0x44, 0x88, 0xcc};
    
    void setup() {
      // Turn on the LED, for indicating activity
      pinMode(LED_BUILTIN, OUTPUT);
      digitalWriteFast(LED_BUILTIN, HIGH);
    
      // Set the pin that enables the transmitter
      pinMode(kTXPin, OUTPUT);
      digitalWriteFast(kTXPin, HIGH);
    
      dmxTx.begin();
    
      // Set some channel values. These are being set in setup() to illustrate that
      // values are 'sticky'. They stay set until changed. There's no special
      // function to call for each iteration of loop().
    
      // Set channel 1 to 128
      dmxTx.set(1, 128);
    
      // Set channels 10-12 to the 3 values in 'data'
      dmxTx.set(10, data, 3);
    }
    
    void loop() {
      // Do something, maybe alter channel values.
    }

  2. #2

  3. #3
    Junior Member
    Join Date
    Aug 2018
    Posts
    8
    certainly!!!!

Posting Permissions

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