Linked from: https://karma-laboratory.com/petridish/2005/04/wp_part_vi_bs2s.html.
//Author: Pearl Chen (pearl at karma-laboratory.com) //Date: Mar 3, 2005 //Revisions: like v9 but with faster baud... (and an arrow animation) // Play around with the framerate... 80 seemed the optimal rate for me. // If you uncomment all the timing-related statements, you can see how long // it takes for a call-and-response between Processing and the Stamp byte[] col = { 0, 56, 56, byte(254), 124, 56, 16, 0 }; //an array of bytes representing what columns to turn on //note: a byte in processing only takes in numbers -127 to +127 which is why I used byte() for numbers > 127 byte tempcol = 0; //temporary data holder //int failed = 0; //temporary counter used to adjust timing //timing stuff //int msNow; //int msLast; //int msElapsed; void setup() { framerate(80); //println("//////////////////////new//////////////////////"); beginSerial(125000); //begin serial connection, default is 9600 baud but 125000 is faster //msNow = millis(); //msLast = msNow; } void serialEvent() { //if (serial == 48) { //Ascii 0 //msNow = millis(); //msElapsed = msNow - msLast; //println(msNow +" - "+ msLast + " = " + msElapsed); //msLast = msNow; //}else if (serial == 49) { //Ascii 1 increment(); } } void updateMatrix() { //println("writing serial data"); serialWrite('A'); serialWrite(col); } void increment() { //println("Number of failed rendezvous: " + failed); //failed = 0; //println("incrementing"); tempcol = col[7]; for (int i=7; i>0; i--) { col[i] = col[i-1]; //println(i + ": " + col[i]); } col[0] = tempcol; //println(0 + ": " + col[0]); } void loop() { updateMatrix(); //failed ++; }