ok I am modifying a email notifier I found on-line, it is supposed to flash when I get a new email (I have a python script that sends "m" to the serial port when I have mail and "n" when I don't) but when I get a email it flashes... and dosnt stop I have gotten this to work without flashing (just running the code from the Internet) but I would like it to flash.
code:
// led wired + to pin 12, resistor to positive +5v
int value = 255;
int ledpin = 11; // Output connected to digital pin 12
int mail = LOW; // Is there new mail?
int val; // Value read from the serial port
void setup()
{
Serial.begin(9600);
Serial.flush();
}
void loop()
{
// Read from serial port
if (Serial.available())
{
val = Serial.read();
Serial.println(val, BYTE);
if (val == 110)
for(value = 255; value >= 0; value-=5)
{
analogWrite(ledpin, value);
delay(30);
}
while (val == 109)
{
for(value = 255; value >= 0; value-=5)
{
analogWrite(ledpin, value);
delay(30);
}
for(value = 0; value <=255; value+=5)
{
analogWrite(ledpin, value);
delay(30);
}
Serial.read();
}
}
}