#include <FastLED.h>

void setup() {
  Serial.begin(2000000);
}

void loop() {
  static uint32_t timebase = 0;
  static uint16_t prevbeatrate = -1;
  uint16_t beatrate = beat88(5*256);
  if (beatrate < prevbeatrate)
    timebase = GET_MILLIS();
  prevbeatrate = beatrate;
  uint16_t outputty = beat88(beatrate, timebase);

  Serial.print(beatrate);
  Serial.print(" ");
  Serial.println(outputty);

  analogWrite(11, beatrate >> 8);
  analogWrite(10, outputty >> 8);
}