adding link to IXM main page
[ixm-collector.git] / ixm-collector.org
blob304563e943f57063323604647743c5717d1fcdf9
1 #+TITLE: IXM collector
2 #+OPTIONS: num:nil ^:nil
3 #+LaTeX_CLASS: normal
5 See [[http://illuminatolabs.com/IlluminatoXMachina.htm][here]] information on the /Illuminato X Machina/ (IXM)
7 The collector is a small utility which can be included in your
8 sketches to allow printing directly back to a central observer
9 (probably your laptop) through a virtual face.  The following example
10 sketch (included as =sketch.pde= in this repository) demonstrates it's
11 usage.
13 #+begin_src c++
14   /*                                             -*- mode:C++ -*-
15    *
16    * Sketch description: Simple demonstration of the collector
17    * 
18    * Sketch author: Eric Schulte
19    *
20    */
21   #include "collector.h"          // include the collector
22   int cface;                      // the virtual face assigned to the
23                                   //   collector
24   int ledPin = 13;                // LED connected to digital pin 13
25   int wait;                       // a variable for the delay time
26   
27   void setup() {
28     cface = collector_init();     // initialize the collector and assign
29                                   //   the virtual face
30   }
31   
32   void loop() {
33     wait = random(2000);          // set wait to a random number
34     delay(wait);                  // wait for the assigned time
35     digitalWrite(ledPin, LOW);    // sets the LED on
36     // print to the collector face and the result will be automatically
37     //   routed to your laptop
38     facePrintf(cface, "waited %d miliseconds\n", wait);   
39     delay(500);                   // wait for the assigned time 
40     digitalWrite(ledPin, HIGH);   // sets the LED off
41   }
42 #+end_src
44 Once this sketch has burned to your boards, you send a =c=-packet
45 (=c2= in the example below) telling your boards that you will be the
46 collector.  Each =c=-packet should contain a number -- boards keep
47 track of the highest =c=-number they have received and will ignore any
48 =c=-packets with lower numbers.  Once the boards receive this
49 =c=-packet their collector face will be connected to the sender of the
50 =c=-packet.  this is should in the following output of the above
51 example =sketch.pde=.
53 #+begin_example
54   Ln 11.602 [Sending checksum South for 0x10014+32748=AAD8E8E5-86FBCC66]
55   Ln 16.257 [Sending checksum North for 0x18000+12204=A3E9651E-194595F0]
56   Ln 17.953 [Sending checksum South for 0x18000+12204=A3E9651E-194595F0]
57   Ln 19.283 [North burned successfully!]
58   Ln 20.985 [South burned successfully!]
59   c2
60   (-1,1) waited 1349 miliseconds
61   (0,0) waited 3888 miliseconds
62   (1,-1) waited 2374 miliseconds
63   (1,0) waited 4205 miliseconds
64   (-1,-1) waited 2570 miliseconds
65   (1,1) waited 2540 miliseconds
66   (-1,0) waited 3334 miliseconds
67   (1,1) waited 1485 miliseconds
68   (0,0) waited 2455 miliseconds
69   (-1,1) waited 4452 miliseconds
70   (-1,-1) waited 3534 miliseconds
71   (1,0) waited 3948 miliseconds
72   (1,-1) waited 4650 miliseconds
73   (1,-1) waited 430 miliseconds
74   (-1,0) waited 4916 miliseconds
75   (1,-1) waited 464 miliseconds
76   (0,0) waited 3712 miliseconds
77 #+end_example