From 3246c2534ecd8acde842ae1a100e53383c208498 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 16 Feb 2010 11:31:57 -0700 Subject: [PATCH] adding example sketch --- .gitignore | 3 +++ sketch-wrapper.cpp | 22 ++++++++++++++++++++++ sketch.pde | 28 ++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 .gitignore create mode 100644 sketch-wrapper.cpp create mode 100644 sketch.pde diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..51a750b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.o +sketch +sketch.hex diff --git a/sketch-wrapper.cpp b/sketch-wrapper.cpp new file mode 100644 index 0000000..9992f06 --- /dev/null +++ b/sketch-wrapper.cpp @@ -0,0 +1,22 @@ +/* sketch-wrapper.cpp + * + * Do includes and such necessary to support + * an Arduinoish sketch code, which we include from here + */ + +#include "sfb.h" + +void setup(); + +void loop(); + +#include "sketch.pde" + +/* Finally, pull in a fresh header block -- at the bottom, so + * sketch.pde can define SFB_SKETCH_CREATOR_ID and + * SFB_SKETCH_PROGRAM_ID (and SFB_SKETCH_COPYRIGHT_NOTICE) if/as it + * wants. + */ + +#include "SFBProvenanceData.h" + diff --git a/sketch.pde b/sketch.pde new file mode 100644 index 0000000..147bcd2 --- /dev/null +++ b/sketch.pde @@ -0,0 +1,28 @@ +/* -*- mode:C++ -*- + * + * Sketch description: Simple demonstration of the collector + * + * Sketch author: Eric Schulte + * + */ +#include "collector.h" // include the collector +int cface; // the virtual face assigned to the + // collector +int ledPin = 13; // LED connected to digital pin 13 +int wait; // a variable for the delay time + +void setup() { + cface = collector_init(); // initialize the collector and assign + // the virtual face +} + +void loop() { + wait = random(5000); // set wait to a random number + delay(wait); // wait for the assigned time + digitalWrite(ledPin, LOW); // sets the LED on + // print to the collector face and the result will be automatically + // routed to your laptop + facePrintf(cface, "waited %d miliseconds\n", wait); + delay(500); // wait for the assigned time + digitalWrite(ledPin, HIGH); // sets the LED off +} -- 2.11.4.GIT