void setup()
{
  //---------------------------------------------------------------------------
  // configure LED pin
  //---------------------------------------------------------------------------
  pinMode(LED_BUILTIN, OUTPUT);

  //---------------------------------------------------------------------------
  // setup blink timer control
  //---------------------------------------------------------------------------
  BlinkTimerAdapter* blinkTimerAdapter = new BlinkTimerAdapter();
  blinkTimerControl = new BlinkTimerControl(blinkTimerAdapter, BLINK_TIME_MILLIS);

  //-----------------------------------------------------------------------------
  // Serial Command Object for Debug CLI
  //-----------------------------------------------------------------------------
  Serial.begin(115200);
  sCmd = new SerialCommand();

  // Setup callbacks for SerialCommand commands
  if (0 != sCmd)
  {
    sCmd->addCommand("i", incr);
    sCmd->addCommand("d", decr);
    sCmd->setDefaultHandler(unrecognized);      // Handler for command that isn't matched  (says "What?")
  }
  Serial.println("Hello from Neo Matrix Test!\n");

  //-----------------------------------------------------------------------------
  // Battery Voltage Surveillance
  //-----------------------------------------------------------------------------
  batteryAdapter = new MyBatteryAdapter();
  battery = new Battery(batteryAdapter);

  //-----------------------------------------------------------------------------
  // Neo Matrix
  //-----------------------------------------------------------------------------
  new Timer(new LoopTimerAdapter(), Timer::IS_RECURRING, 1000);
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(10);
  matrix.setTextColor(colors[0]);
  matrix.setTextSize(1);
}
void setup() {
  //Initalize the reader
  FlashDevice* device = Devices::createWearLevelErase();
  FlashReader reader(device);

  Serial.begin(9600);
  Serial.println("Starting setup....");

  //Wifi will be disabled at this point
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(100);
  matrix.setTextColor(matrix.Color(80,255,0));
  matrix.fillScreen(0);

  //We're not connected to WIFI just yet but we need a number to show
  int salvations = reader.readInt();

  //Show salvations unless something isn't stored in memory.
  if(salvations >= 0){
    showSalvations(salvations, 0);
  }else{
    matrix.print(F("******"));
    matrix.show();
  }

  pinMode(batteryPin, INPUT_PULLUP);

  //Now that everything is done and being shown, lets quietly connect to wifi.
  if ( Spark.connected() == false){
    Spark.connect();
  }
}
Example #3
0
void setup() {
    matrix.begin();
    matrix.setRemapFunction(remapXY);
    matrix.setTextWrap(false);   // Allow scrolling off left
    matrix.setTextColor(0xF800); // Red by default
    matrix.setBrightness(31);    // Batteries have limited sauce

    BTLEserial.begin();

    pinMode(LED, OUTPUT);
    digitalWrite(LED, LOW);
}