Hi, i'm trying to get an LED to raise (and lower) much as you would with a for loop. instead though i was trying to remap the second() value...
secondMap = map(second(), 0, 59, 0, 255);
...and then use that value...
analogWrite(ledPin, secondMap);
it doesn't like it and i'm wondering if it's something i'm doing or if you just can't remap the second value for some reason.
any suggestions greatly appreciated...
ben
sorry... yes. i'm trying to write a program to control the light cycle of a vivarium. i also want it to be measuring temperature. i'm trying to avoid putting delays into the program by remapping the seconds value of the clock (Time.h) to a scale of 0, 255 so that i can plug that straight into the analogWrite() so that the led will scale up relative to the timeclock - in reality it will be set to fade up over the space of an hour but i want to set it to run over a minute so that i can check it's working and tinker with light sequences in a scaled down time sequence.
i hope this is a bit more helpful. i've just deleted my attemtps at mapping the seconds as i was trying something else (unsuccessfully) to get it to work so all i have now is a clock....
void printDigits(int digits)
{
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
... and a few pointless integers.
e2a: error message was 'seconds was not declared in this scope'