Hi to every one. I'm making my own Hard drive persitance of vision clock, and thanks to the help of this forum I've done great advances, i'm almost done.
What I'm trying to do now is make an RGB background for the clock, like shown on the "RGB effect.png" attached image.
I've started with something simple like a gradient of only one color, something like this:
and this is my code for that:
void interrupt() // INTERRUPCION
{
go=true;
}
void loop()
{
if(go)
{
for (int i=255; i>0; i--)
{
analogWrite(pinG, i); // pin G is a PWN pin connected to a RGB led strip through an uln2003
delayMicroseconds(10);
}
digitalWrite(pinG, LOW);
go=false;
}
}
but the result of this is shown on this video. Its like if I am seeing the On and OFF of the PWM cycle... I'm pretty sure that's the problem, but... how can I solve it? I know its possible because I've seen videos (like the image attached) that made it using arduino. I've also tried using two colors at the same time to mix the the on and off cycles but still getting the same arbitrary effect.
Sorry, here is the complete code, but there is nothing more to see
#include <Servo.h>
#define pinG 3 //Green pin \
#define pinB 5 //Blue pin |->> RGB led Strip through ULN2003
#define pinR 11 //Red pin /
Servo esc;
volatile boolean go = false;
void setup()
{
attachInterrupt(0, interrupt, FALLING);
esc.attach(9);
Serial.begin(9600);
esc.writeMicroseconds(1100);
delay(3000);
esc.writeMicroseconds(1415); //This is for start the hard drive motor.
delay(500);
}
void interrupt() // This is triggered by a magnet glued on the plate and a hall effect sensor
{
go=true;
}
void loop()
{
if(go)
{
for (int i=255; i>0; i--)
{
analogWrite(pinG, i); // pin G is a PWN pin connected to a RGB led strip through an uln2003
delayMicroseconds(10);
}
digitalWrite(pinG, LOW);
go=false; // I do this to ensure that the loop is running only one time with each revolution of the plate
}
}
I've attached another image showing the hardware, it's not he same hardware i'm using in the video but works the same way.
Any way I didn't know that pwm could be converted to analogue voltage, I think that would be the solution!
I've found this: Arduino Playground - RegulatedPositiveVoltageBooster which has this circuit
But I don't know if that would work, and I also have some quiestiones about that circuit.
What's the difference between Analog Out (Aout) and Vout? Wich of them should I use to power the RGB led strip? I guess its Aout, but can I simply ignore Vout? Do I need it?
It says that Aout goes from 0V to 5V, can I use the Aout to control the ULN2003 so the leds will recieve 0V to 12V (from an ATX Pc power supply)???