Go Down

Topic: ShiftPWM support topic. Latest update: Schematics, high power LED's, LED strips (Read 83 times) previous topic - next topic

ronnagle1967

Looking to use ShiftPWM with Vixen for holiday light display. Vixen outputs via Serial
I want to create a code that will take Vixen Output and convert it to ShiftPWM to control relays and Transistors.
Any help is appreciated!

Below is code that allows Vixen to control Arduino

/*
The purpose of this code is to allow the Arduino to use the
generic serial output of vixen lights to control 5 channels of LEDs.
Author: Matthew Strange
Created: 14 October 2010

*/

// Output
int Chan1 = 2;  // red LED,   connected to digital pin 5
int Chan2 = 3;  // green LED, connected to digital pin 6
int Chan3 = 4;  // red LED,  connected to digital pin 9
int Chan4 = 5;  // green LED,  connected to digital pin 10
int Chan5 = 6;  // red LED,  connected to digital pin 11

int i = 0;     // Loop counter
int incomingByte[7];   // array to store the 7 values from the serial port

//setup the pins/ inputs & outputs
void setup()
{
  Serial.begin(9600);        // set up Serial at 9600 bps

  pinMode(Chan1, OUTPUT);   // sets the pins as output
  pinMode(Chan2, OUTPUT);
  pinMode(Chan3, OUTPUT);
  pinMode(Chan4, OUTPUT);
  pinMode(Chan5, OUTPUT);
}

void loop()
{  // 7 channels are coming in to the Arduino
   if (Serial.available() >= 7) {
    // read the oldest byte in the serial buffer:
    for (int i=0; i<8; i++) {
      // read each byte
      incomingByte = Serial.read();
    }
   
    analogWrite(Chan1, incomingByte[0]);   // Write current values to LED pins
    analogWrite(Chan2, incomingByte[1]);   // Write current values to LED pins
    analogWrite(Chan3, incomingByte[2]);   // Write current values to LED pins
    analogWrite(Chan4, incomingByte[3]);   // Write current values to LED pins
    analogWrite(Chan5, incomingByte[4]);   // Write current values to LED pins
   }
}

ematson5897


ronnagle1967

elcojacobs said before that ShiftPWM could be used for relays just set to maxbrightness for on and zero for off.
Looking forward to seeing your code.

milamber

ematson, I too would love to see your code and how you setup vixen to use it. I have a similar "Christmas" project in mind.

TBSkinner

#244
Jun 25, 2012, 08:37 pm Last Edit: Jun 28, 2012, 09:14 pm by TBSkinner Reason: 1
I have read threw quite a bit of the forum posts, and still had a few questions. I am trying to make tail lights for my car that are a set of 5x10 rgb LEDs. I was wondering if it would be better to use ShiftMatrixPWM or ShiftPWM? I would essentially be controlling 600 LEDs so it is within the scope of ShiftPWM but I am concerned about the brightness. I'm very new to programming and Arduino. So if there are some easy examples that would help me out it would be greatly appreciated, maybe something that will help me build a power supply for the ShiftMatrixPWM? I have already made a mock up of an led matrix. Thanks for any help.

Skinner

I have made a schematic of the circuit I would like to make. Any help wiring it to the arduino would be greatly appreciated. Also i'm not sure about my power circuit and if I need anything else like capacitors in it.

Go Up