diff --git a/README.md b/README.md index 42b6e76..cab8639 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ -TeensyStripController 1.03 +TeensyStripController 1.04 ========================== -Firmware for a Teensy 3.1 or Teensy 3.2 to control WS2811/WS2812 based ledstrips. Fully compatible with the DirectOutput Framework. +Firmware for a Teensy 3.1, 3.2 or 4.0 to control WS2811/WS2812 based ledstrips. Fully compatible with the DirectOutput Framework. ![Teensy 3.1 with OctoWS2811 adaptor](http://www.pjrc.com/store/octo28_adaptor_6.jpg) Hardware -------- -This code has been designed for Teensy 3.1 or Teensy 3.2. For easy installation of the ledstrips is is highly recommended to get a OctoWS2811 adaptor board as well. +This code has been designed for Teensy 3.1, 3.2. or Teensy 4.0 For easy installation of the ledstrips is is highly recommended to get a OctoWS2811 adaptor board as well. + Both boards are available at http://pjrc.com/store/ For the Teensy be sure to get a Teensy 3.2, preferably the version which has the pins already soldered in. @@ -27,11 +28,10 @@ To drive the controller at least DirectOutput Framework R3 is required. Check ou Integrated Product ------------------ -The Oak Micros Pinball Addressable LEDs (PAL) board is a pre-built integrated product that can be used to control up to 8 addressable LEDs strips. It uses the Teensy 3.2 and the latest software from this site. It includes a pushbutton which can be used to initiate a LED test when powered up and has a pluggable screw connector for power and 6 LED connections. The remaining two other LED connections are available on an optional 0.1" header. - -![Oak Micros PAL board](http://vpforums.org/imghost/24/pal_board.jpg) +For people not very comfortable with lots of wires, stripping and crimping, GermanGamingSupplies developed a nice little Box that makes it much more easy and convenient to install it into your VPins. +Go to Product: ![Link](https://germangamingsupplies.com/Teensy-Control-Box_1) -For further information read the [user guide](https://drive.google.com/open?id=1Zk_5RxsWX4VIPhT4XtGlj1rNlBTug39a) and see [this thread](https://www.vpforums.org/index.php?showtopic=43482) on VPForums.org. +![Teensy Control Box](https://germangamingsupplies.com/media/image/product/115/lg/teensy-control-box_1.jpg) Documentation ------------- diff --git a/TeensyStripController.ino b/TeensyStripController.ino index 61ba512..5728af0 100644 --- a/TeensyStripController.ino +++ b/TeensyStripController.ino @@ -48,13 +48,18 @@ pin 3 - Do not use as PWM. Normal use is ok. */ - +#include "arduino.h" #include "OctoWS2811Ext.h" //A slightly hacked version of the OctoWS2811 lib which allows for dynamic setting of the number of leds is used. //Definiton of Major and Minor part of the firmware version. This value can be received using the V command. //If something is changed in the code the number should be increased. #define FirmwareVersionMajor 1 -#define FirmwareVersionMinor 3 +#define FirmwareVersionMinor 4 + +//For Teensy 4.0 you can define the nuber of ouput Pins - 8 should be good (for 3.1/3.2 this is only used for calculation and schould not changed) +const int numPins = 8; +//for tesnsy 4.0 you can change the standard port (schould not be done) - Not used for 3.1/3.2 +byte pinList[numPins] = {2, 14, 7, 8, 6, 20, 21, 5}; //Defines the max number of leds which is allowed per ledstrip. //This number is fine for Teensy 3.2, 3.1. For newer Teensy versions (they dont exists yet) it might be possible to increase this number. @@ -68,8 +73,8 @@ #define TestPin 17 //Memory buffers for the OctoWS2811 lib -DMAMEM int displayMemory[MaxLedsPerStrip*6]; -int drawingMemory[MaxLedsPerStrip*6]; +DMAMEM int displayMemory[MaxLedsPerStrip * numPins * 3 / 4]; +int drawingMemory[MaxLedsPerStrip * numPins * 3 / 4]; //Variable used to control the blinking and flickering of the led of the Teensy elapsedMillis BlinkTimer; @@ -79,9 +84,13 @@ elapsedMillis BlinkModeTimeoutTimer; //Config definition for the OctoWS2811 lib const int config = WS2811_RGB | WS2811_800kHz; //Dont change the color order (even if your strip are GRB). DOF takes care of this issue (see config of ledstrip toy) -OctoWS2811Ext leds(MaxLedsPerStrip, displayMemory, drawingMemory, config); +#if defined(__IMXRT1062__) + OctoWS2811Ext leds(MaxLedsPerStrip, displayMemory, drawingMemory, config, numPins, pinList); +#else + OctoWS2811Ext leds(MaxLedsPerStrip, displayMemory, drawingMemory, config); +#endif -word configuredStripLength=144; +word configuredStripLength=448; //Setup of the system. Is called once on startup. void setup() { @@ -142,6 +151,10 @@ void loop() { //Get max number of leds per strip SendMaxNumberOfLeds(); break; + case 'T': + //initiate Test over serial + Test(); + break; default: // no unknown commands allowed. Send NACK (N) Nack(); @@ -368,7 +381,7 @@ word ReceiveWord() { void Test() { - int microsec = 3000000; // change them all in 3 seconds + int microsec = 250000; // change color every 1/4 second ColorWipe(RED, microsec); ColorWipe(GREEN, microsec);