Source code for the Curilights Controller. See http://www.saccade.com/writing/projects/CuriController/ for details.

Dependencies:   FatFileSystem mbed

This is the source code for the Curilights controller. This lets you interactively control a string of Curilights. It provides a simple click-wheel user interface for changing colors, brightness and behavior. It responds to movement and lighting.

Finished Controller

/media/uploads/isonno/nxp3872_controllerclose.jpg

System Block Diagram

/media/uploads/isonno/blockdiagram.png

Revision:
0:6da5625a6946
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PushButton.h	Thu Dec 29 01:59:53 2011 +0000
@@ -0,0 +1,44 @@
+// Wrapper function for PinDetect providing 
+// simple "pushbutton" functionality
+
+#ifndef _PUSHBUTTON_
+#define _PUSHBUTTON_
+
+#ifndef MBED_H
+#include "mbed.h"
+#endif
+
+class PushButton
+{
+public:
+    PushButton( PinName pin, const char * name = NULL ) : fPin( pin )
+    {
+        if (name && strlen(name) < sizeof(fName))
+            strcpy( fName, name );
+        else
+            strcpy( fName, "UNKNOWN" );
+        fPin.setSampleFrequency( 3000 );
+        fPin.mode( PullUp );
+        fPin.attach_deasserted( this, &PushButton::SwitchHit );
+    }
+    
+    template<typename T>
+    void attach(T* tptr, void (T::*mptr)(void))
+    {
+        if((mptr != NULL) && (tptr != NULL))
+            fPin.attach_deasserted( tptr, mptr );
+    }
+    
+    void detach() { fPin.detach(); }
+
+    void SwitchHit()
+    {
+        printf("Pushbutton %s is hit!\n\r", fName);
+    }
+
+private:
+    PinDetect fPin;
+    char fName[20];    
+};
+
+#endif