Hello,
I am new here and I have a problem with my first project.
I have bought 5m of RGB led strip, an arduino mega, 3 power mosfets to control each color and a 12v 14A power supply.
The intention is to control the strip with my iphone using processing and touchOSC. I've been following a tutorial to accomplish this and it goes like this
-StandardFirmata uploaded to the arduino
-installed all libray's that are required.
-Processing code:
import processing.serial.;
import cc.arduino.;
import oscP5.;
import netP5.;
Arduino arduino;
OscP5 oscP5;
float redAmount = 0.0f;
float greenAmount = 0.0f;
float blueAmount = 0.0f;
void setup(){
size(320, 480);
background(0);
oscP5 = new OscP5(this, 8000);
arduino = new Arduino(this, Arduino.list()[0],57600);
}
void draw(){
background(redAmount, greenAmount, blueAmount);
fill(0);
//Rode Rechthoek
stroke(255,0,0);
rect(34,39,67,255);
fill(50,40,40);
rect(34,39+255,67,-redAmount);
//Groene rechthoek
fill(0);
stroke(0,255,0);
rect(124,39,67,255);
fill(40,50,40);
rect(124,39+255,67,-greenAmount);
//Blauwe rechthoek
fill(0);
stroke(0,0,255);
rect(216,39,67,255);
fill(40,40,50);
rect(216,39+255,67,-blueAmount);
//Naar Arduino Schrijven(Rood op pin 11,groen op pin 10, blauw op pin 9)
arduino.analogWrite(11, int(redAmount));
arduino.analogWrite(10, int(greenAmount));
arduino.analogWrite(9, int(blueAmount));
}
void oscEvent(OscMessage theOscMessage){
String addr = theOscMessage.addrPattern();
float val = theOscMessage.get(0).floatValue();
if(addr.equals("/1/Rood")){ redAmount = val;}
if(addr.equals("/1/Groen")){ greenAmount = val;}
if(addr.equals("/1/Blauw")){ blueAmount = val;}
}
-Correct OSC program build using OSCeditor
Now my problem is that the controls and such work but the string is flickering irregularly like there is some kind of noise on it.
What could cause this? I've tried a single led on the arduino but it still does the same.
Thanks
LouisG