heya this is what i have done so far with the script its working marvelously with the analog laser im using thank you for your assistance just a few quick questions. the replacement of irq to blink . what are these to commands functions as i cant find them in the reference page at all yes blink is working in the script but i am trying to work in a second interrupt pin for reset to "count 0" at any time for full laser blanking just wondering how i could do this as i have tried to double up on the input codes and change the listing for the next pin over to create a second count but it didnt work "guessing there can only be only 1 total count tally "
this is harder than i though it would be to learn from scratch ..lol
int pin = 9;// led out
volatile int counter = 0; //pin 2 interupt imput
void setup()
{
pinMode(pin, OUTPUT);
attachInterrupt(0, blink, RISING); // HIGH -> LOW
}
void loop()
{
if (counter == 1)
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(pin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
if (counter == 2)
{
digitalWrite(pin,LOW);
}
if (counter == 3)
{
analogWrite(pin,15);
}
if (counter == 4)
{
digitalWrite(pin,LOW);
}
if (counter == 5)
{
digitalWrite(pin,HIGH);
}
if (counter == 6 )
{
digitalWrite (pin ,LOW);
}
if (counter == 7)
{
analogWrite(pin,25);
}
if (counter == 8)
{
digitalWrite(pin,LOW);
}
if (counter == 9)
{
analogWrite(pin,30);
}
if (counter == 10)
{
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(pin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
if (counter == 11)
{
digitalWrite(pin,LOW);
}
if (counter == 12)
{
digitalWrite (pin ,HIGH);
}
if (counter == 13)
{
analogWrite(pin,40);
}
if (counter == 14)
{
digitalWrite(pin,LOW);
}
if (counter == 15)
{
digitalWrite(pin,HIGH);
}
if (counter == 16)
{
digitalWrite (pin ,LOW);
}
if (counter == 17)
{
analogWrite(pin,50);
}
if (counter == 18)
{
analogWrite(pin,128);
}
if (counter == 19)
{
digitalWrite(pin,LOW);
}
if (counter == 20)
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(pin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
if (counter == 21)
{
digitalWrite(pin,HIGH);
}
if (counter == 22)
{
analogWrite(pin,70);
}
if (counter == 23)
{
digitalWrite(pin,HIGH);
}
if (counter == 24)
{
analogWrite(pin,80);
}
if (counter == 25)
{
digitalWrite(pin,LOW);
}
if (counter == 26 )
{
digitalWrite (pin ,HIGH);
}
if (counter == 27)
{
analogWrite(pin,85);
}
if (counter == 28)
{
digitalWrite(pin,LOW);
}
if (counter == 29)
{
analogWrite(pin,95);
}
if (counter == 30)
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(pin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
if (counter == 31)
{
digitalWrite(pin,LOW);
}
if (counter == 32)
{
digitalWrite (pin ,HIGH);
}
if (counter == 33)
{
analogWrite(pin,105);
}
if (counter == 34)
{
analogWrite(pin,200);
}
if (counter == 35)
{
digitalWrite(pin,LOW);
}
if (counter == 36)
{
digitalWrite (pin ,HIGH);
}
if (counter == 37)
{
analogWrite(pin,115);
}
if (counter == 38)
{
digitalWrite(pin,LOW);
}
if (counter == 39)
{
analogWrite(pin,125);
}
if (counter == 40)
{
analogWrite(pin,10);
}
if (counter == 41)
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(pin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
if (counter >= 42)
{
digitalWrite (pin,LOW);
counter =0;
}
}
void blink()
{
counter++;
}