Hi all
Ive got a RGB laser head and the control board has 3 inputs to control the 3 lasers. It can support upto 30Khz and I will eventually have something programmed. For now i would like to use 3 pots to vary the brightness of each laser to allow manual mixing to produce colours. Prob a very simple program but everything im searching is bringing digital to analogue.
Im still learning programming on the arduino and dont want to just guess and damage the board for the lasers
Apologies for the delay in saying thanks. Been trying this and got it working using an uno and 3 leds. Next I connected the laser TTL inputs and it does what it says on the tin and i can change the brightness/power. I wanted this on a small board in the same box. I used a nano and thats where it all stops working. Attached is the schematic (using LEDs for the laser), very simple and also the code. Do the nanos work differently to the uno's as im stuck now. All I get is a few quick flashes but dont want to leave it connected. All i can think of is timings to do with the pwm.
const int Rpwm = 3 ; //naming pin 3 as ‘Red pwm’ variable
const int Radc = 0 ; //naming pin 0 of analog input side as ‘Red adc’
const int Gpwm = 5 ; //naming pin 5 as ‘Green pwm’ variable
const int Gadc = 1 ; //naming pin 1 of analog input side as ‘Greenadc’
const int Bpwm = 6 ; //naming pin 6 as ‘Blue pwm’ variable
const int Badc = 2 ; //naming pin 2 of analog input side as ‘Blue adc’
void setup()
{
pinMode(Rpwm, OUTPUT) ;
pinMode(Gpwm, OUTPUT) ;
pinMode(Bpwm, OUTPUT) ;
}
void loop()
{
int Radc = analogRead(0) ; //reading Red analog voltage and storing it in an integer
Radc = map(Radc, 0, 1023, 0, 255);
int Gadc = analogRead(1) ; //reading Green analog voltage and storing it in an integer
Gadc = map(Gadc, 0, 1023, 0, 255);
int Badc = analogRead(2) ; //reading Blue analog voltage and storing it in an integer
Badc = map(Badc, 0, 1023, 0, 255);
analogWrite(Rpwm, Radc) ;
analogWrite(Gpwm, Gadc) ;
analogWrite(Bpwm, Badc) ;
}
The code is form a site that was linked to above by groundfungus. I'm not a programmer. I get some of it and figure out other bits. I copied it and added in the extra 2 colours. All I know is it works on the uno but just 're reading that page it mentions the nano and 7volt while the uno is 5volt. Not sure if this has anything to do with it or how to fix it