The sketch in pingpong::cpp responded the same way to 'ping' packets arriving on any face. This sketch shows a way of responding more narrowly, only when certain types of packets occur on certain faces.

In this sketch, any type 'd' packet arriving on the east face is forwarded out the west face, and vice-versa. But 'd's arriving from the north or south are simply ignored.

// Forward 'd' packets between east and west only

void doForward(u8 * packet) {

  // Send a copy of the packet out the opposite face of its source; so
  // if source is EAST, print to WEST, and vv.  (NORTH and SOUTH can't
  // arise as sources here, because there are no reflexes for that)


void setup() {
  EastFace.reflex('d', doForward);       // doForward handles 'd' from EAST 
  WestFace.reflex('d', doForward);       // and doForward handles 'd' from WEST 

void loop() { /* Nothing to do! */ }

Generated on Fri Apr 22 06:54:10 2011 for SFB by doxygen 1.5.9