can anyone please help me with my arduino codes.
I am beginner with arduino. I am writing a code to control my 50hz laser externally. my code needs to be have 2 functions.
1. need to give a continues pulse of 20milliseconds.
2. when i trigger the switch, I should get one single pulse of 20ms with a required delay.
both these pulses are different. but i have tried with some coding. the problem with my code is that when i press the trigger, I will get one single pulse, but it will stop the 1st 50hz continues pulse. @
my codes are given below, If you have any idea can you please help me. also i have given the images from oscilloscope.
int out = 12;
int out1 = 8;
int valueout = 0;
int val = 0;
void setup() {
pinMode(button, INPUT);
pinMode(out, OUTPUT);
pinMode(out1, OUTPUT);
}
void loop() {
{
digitalWrite(out, HIGH);
delay(19.6);
valueout = 1;
digitalWrite(out, LOW);
delayMicroseconds(400);
valueout = 0;
}
{
val = digitalRead(button);
}
{
val = digitalRead(button);
if (valueout == 0 && val == HIGH){
delayMicroseconds(1000);
digitalWrite(out1, HIGH);
delay(19);
digitalWrite(out1, LOW);
delay(1000);}
else{
digitalWrite(out1, LOW);}
}
}