This is a stimulation code but it stimulates the muscle constantly i need a duration here but i just couldnt think a way to do it here im literally stuck i need help any help will be appreciated it should stimulate like maybe 10 seconds
like this is for eye muscle stimulation it gives certain amount of electricity and in the loop part it gives current and the frequency is the currents frequency but the pulse of the current shouldnt be constant for example the eye muscle should be stimulated 10 seconds how do i limit the time of stimulation in this code?
digitalWrite( LedPin, HIGH );
startPoint = millis();
}
if( millis() >= startPoint + duration ){
digitalWrite( LedPin, LOW );
}
pwmWrite(led_pin_pwm, 127);
}
this the final product without pulse duration whenever it detects a blink it should stimulate the other eye so it is if / else statement rather than a loop
So you want the output on led_pin_pwm to be 10 seconds then the pin goes to GND (0V) .
BTW
In the Arduino IDE, use CtrlT or CMDT to format your code then copy the complete sketch.
Use the </> icon from the ‘reply menu’ to attach the copied sketch.