Handy Serial Debugging Code


#1

This is just a useful piece of code Jon and I made where we can check what values are being received on a specific face of the Blink.

/*
   Message Debugger
*/

#include "Serial.h"

ServicePortSerial Serial;

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

void loop() {

  // read in message on each face
  FOREACH_FACE(f) {
    if (!isValueReceivedOnFaceExpired(f)) {
      if (didValueOnFaceChange(f)) {
        Serial.print("face ");
        Serial.print(f);
        Serial.print(": ");
        Serial.println(getLastValueReceivedOnFace(f));
      }
    }
  }
}

#2

Fyi, I implemented a new LogSerial class which supports printf style formatting. See details here: New LogSerial class