Christopher De Vries avatar Christopher De Vries committed 3fab0c0

Modified the extensions of the example sketches to end in .ino and modified includes so that the library will include Arduino.h instead of WProgram.h for version 1.0 or later of the arduino software.

Comments (0)

Files changed (7)

  * is included in the file LICENSE.txt
  ****************************************************************************/
 
-#include "Wprogram.h"
-#include "SPI.h"
 #include "TCL.h"
 
 TclClass TCL;
  ****************************************************************************/
 #ifndef TCL_h
 #define TCL_h
-#include <Wprogram.h>
-#include <SPI.h>
+#if defined(ARDUINO) && ARDUINO >= 100
+#include "Arduino.h"
+#else
+#include "WProgram.h"
+#endif
+#include "SPI.h"
 
 class TclClass {
   public:
 <project name="arduino-tcl" default="zip" basedir=".">
 
   <target name="init">
-    <property name="version" value="1.0"/>
+    <property name="version" value="1.1"/>
     <property name="zipname" value="arduino-TCL-${version}.zip"/>
   </target>
 

examples/fire/fire.ino

+/*****************************************************************************
+ * fire.ino
+ *
+ * This example will send a flickering fire sequence down a 25 pixel long
+ * strand of total control lighting. It uses random numbers to shift in
+ * intensity and color between two color limits.
+ *
+ * Copyright 2011 Christopher De Vries
+ * This program is distributed under the Artistic License 2.0, a copy of which
+ * is included in the file LICENSE.txt along with this library.
+ ****************************************************************************/
+#include <SPI.h>
+#include <TCL.h>
+
+const int LEDS = 25; // There are 25 LEDs in the Total Control Lighting Strand
+byte color1[] = {0xff, 0x00, 0x00};
+byte color2[] = {0xff, 0x90, 0x00};
+
+const int transition_low = 0;
+const int transition_high = 101;
+
+const int intensity_low = 0;
+const int intensity_high = 101;
+
+void setup() {
+  TCL.begin();
+
+}
+
+void loop() {
+  int i;
+  int transition;
+  int intensity;
+
+  TCL.sendEmptyFrame();
+  for(i=0;i<LEDS;i++) {
+    transition=(int)random(transition_low,transition_high);
+    intensity=(int)random(intensity_low,intensity_high);
+    sendTransitionScaleFrame(color1,color2,transition,intensity);
+  }
+  TCL.sendEmptyFrame();
+
+  delay(50);
+}
+
+void sendTransitionScaleFrame(byte *c1, byte *c2, int transition, int intensity) {
+  byte rscale;
+  byte gscale;
+  byte bscale;
+
+  rscale = ((c2[0]-c1[0])*transition/100+c1[0])*intensity/100;
+  gscale = ((c2[1]-c1[1])*transition/100+c1[1])*intensity/100;
+  bscale = ((c2[2]-c1[2])*transition/100+c1[2])*intensity/100;
+
+  TCL.sendColor(rscale,gscale,bscale);
+}

examples/fire/fire.pde

-/*****************************************************************************
- * fire.pde
- *
- * This example will send a flickering fire sequence down a 25 pixel long
- * strand of total control lighting. It uses random numbers to shift in
- * intensity and color between two color limits.
- *
- * Copyright 2011 Christopher De Vries
- * This program is distributed under the Artistic License 2.0, a copy of which
- * is included in the file LICENSE.txt along with this library.
- ****************************************************************************/
-#include <SPI.h>
-#include <TCL.h>
-
-const int LEDS = 25; // There are 25 LEDs in the Total Control Lighting Strand
-byte color1[] = {0xff, 0x00, 0x00};
-byte color2[] = {0xff, 0x90, 0x00};
-
-const int transition_low = 0;
-const int transition_high = 101;
-
-const int intensity_low = 0;
-const int intensity_high = 101;
-
-void setup() {
-  TCL.begin();
-
-}
-
-void loop() {
-  int i;
-  int transition;
-  int intensity;
-
-  TCL.sendEmptyFrame();
-  for(i=0;i<LEDS;i++) {
-    transition=(int)random(transition_low,transition_high);
-    intensity=(int)random(intensity_low,intensity_high);
-    sendTransitionScaleFrame(color1,color2,transition,intensity);
-  }
-  TCL.sendEmptyFrame();
-
-  delay(50);
-}
-
-void sendTransitionScaleFrame(byte *c1, byte *c2, int transition, int intensity) {
-  byte rscale;
-  byte gscale;
-  byte bscale;
-
-  rscale = ((c2[0]-c1[0])*transition/100+c1[0])*intensity/100;
-  gscale = ((c2[1]-c1[1])*transition/100+c1[1])*intensity/100;
-  bscale = ((c2[2]-c1[2])*transition/100+c1[2])*intensity/100;
-
-  TCL.sendColor(rscale,gscale,bscale);
-}

examples/rainbow/rainbow.ino

+/*****************************************************************************
+ * rainbow.ino
+ *
+ * This example will send a sequence of rainbow colors down a 25 pixel long
+ * strand of total control lighting. The Arduino will send an update every
+ * second to the strand, although this is unnecessary and if you disconnect
+ * the Arduino from the strand, you will see that as long as the lights have
+ * power, they will retain the last color information sent to them.
+ *
+ * Copyright 2011 Christopher De Vries
+ * This program is distributed under the Artistic License 2.0, a copy of which
+ * is included in the file LICENSE.txt along with this library.
+ ****************************************************************************/
+#include <SPI.h>
+#include <TCL.h>
+
+const int LEDS = 25; // There are 25 LEDs in the Total Control Lighting Strand
+const byte red[] = {0xff, 0xff, 0xff, 0x00, 0x00};
+const byte green[] = {0x00, 0x60, 0xb0, 0x80, 0x00};
+const byte blue[] = {0x00, 0x00, 0x00, 0x00, 0xff};
+
+void setup() {
+  TCL.begin();
+
+}
+
+void loop() {
+  int i;
+
+  TCL.sendEmptyFrame();
+  for(i=0;i<LEDS;i++) {
+    TCL.sendColor(red[i%5],green[i%5],blue[i%5]);
+  }
+  TCL.sendEmptyFrame();
+
+  delay(1000);
+}

examples/rainbow/rainbow.pde

-/*****************************************************************************
- * rainbow.pde
- *
- * This example will send a sequence of rainbow colors down a 25 pixel long
- * strand of total control lighting. The Arduino will send an update every
- * second to the strand, although this is unnecessary and if you disconnect
- * the Arduino from the strand, you will see that as long as the lights have
- * power, they will retain the last color information sent to them.
- *
- * Copyright 2011 Christopher De Vries
- * This program is distributed under the Artistic License 2.0, a copy of which
- * is included in the file LICENSE.txt along with this library.
- ****************************************************************************/
-#include <SPI.h>
-#include <TCL.h>
-
-const int LEDS = 25; // There are 25 LEDs in the Total Control Lighting Strand
-const byte red[] = {0xff, 0xff, 0xff, 0x00, 0x00};
-const byte green[] = {0x00, 0x60, 0xb0, 0x80, 0x00};
-const byte blue[] = {0x00, 0x00, 0x00, 0x00, 0xff};
-
-void setup() {
-  TCL.begin();
-
-}
-
-void loop() {
-  int i;
-
-  TCL.sendEmptyFrame();
-  for(i=0;i<LEDS;i++) {
-    TCL.sendColor(red[i%5],green[i%5],blue[i%5]);
-  }
-  TCL.sendEmptyFrame();
-
-  delay(1000);
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.