inplermenting strobe function
hello in making led flashlight arduino pro mini inside contole led on mosfet.
i have pwm working 5 steps , resetting love have strobe function
but have no idea how
this code
i want press button after led on full power (255) instead of going 0 going strobe , wen press 1 more time turns off
if can me greateful
i have pwm working 5 steps , resetting love have strobe function
but have no idea how
this code
code: [select]
int switchpin = 8;
int ledpin = 11;
boolean lastbutton = low;
boolean currentbutton = low;
int ledlevel = 0;
int voltin1 = a0;
float volt1;
void setup()
{
pinmode(switchpin, input);
pinmode(ledpin, output);
}
boolean debounce(boolean last)
{
boolean current = digitalread(switchpin);
if (last != current)
{
delay(5);
current = digitalread(switchpin);
}
return current;
}
void loop()
{
currentbutton = debounce(lastbutton);
if (lastbutton == low && currentbutton == high)
{
ledlevel = ledlevel + 51;
}
lastbutton = currentbutton;
if (volt1 = 9)ledlevel = 0;
if (ledlevel > 255) ledlevel = 0;
analogwrite(ledpin, ledlevel);
volt1 = analogread(voltin1);
volt1 = volt1 / 24;
}
i want press button after led on full power (255) instead of going 0 going strobe , wen press 1 more time turns off
if can me greateful
Arduino Forum > Using Arduino > Programming Questions > inplermenting strobe function
arduino
Comments
Post a Comment