24 #if defined(ARDUINO) && ARDUINO >= 100
133 unsigned long duration = 0;
134 for (
unsigned int index = 0; index < size; ++index)
135 duration += (1000 / lengths[index]) * 13 / 10;
136 _loopCount = (int)(ms / duration);
151 loopsLeft = _loopCount;
203 this->lengths = lengths;
218 if ((millis() - startNote) >= duration) {
224 void Melody::nextNote()
227 if (loopsLeft != 0 && --loopsLeft <= 0) {
233 duration = 1000 / lengths[posn];
234 if (notes[posn] != NOTE_REST)
235 tone(_pin, notes[posn], duration);
237 duration = duration * 13 / 10;
238 startNote = millis();