Spidey Wall is the name for a physical wall lit up by multiple addressable LED strips. This program is an LPC1768 web server to control the wall from a browser.

Dependencies:   EthernetInterfacePlusHostname RdWebServer mbed-rtos mbed

This project is part of a Light-Wall using addressable LED strips (WS2801). I have published a few posts on my blog about the construction of the wall and building a game to play on it (PacMan). I have also had a guest post from a friend who has set his children the task of producing some interesting animations. The original post is http://robdobson.com/2015/07/spidey-wall/ /media/uploads/Bobty/20130722_112945_img_9674_62895-1184x1579.jpg

So far, however, I hadn't fully connected the physical (and electronic) wall with the web-browser creations to drive it. This project is hopefully the final link. A fast and reliable web server using REST commands to drive the 1686 LEDs in the Spidey Wall from code running in a browser (say on an iPad while you are playing a game).

The approach taken here results in the ability to control the RGB values of all 1686 LEDs at a rate of 20 frames per second.

A blog post describing the whole thing is here:

http://robdobson.com/2015/08/a-reliable-mbed-webserver/

Revision:
4:b521815f2657
Parent:
3:e5ea80fae61d
Child:
5:910909f34907
--- a/DrawingManager.cpp	Mon Aug 31 09:03:15 2015 +0000
+++ b/DrawingManager.cpp	Mon Aug 31 15:21:47 2015 +0000
@@ -1,5 +1,5 @@
 //
-// Drawing Manager for Pancake Drawbot
+// Drawing Manager for LightWall
 // Rob Dobson 2015
 //
 
@@ -12,7 +12,7 @@
     isBusy = false;
 }
 
-void DrawingManager::init(int numLeds, int splitPoint)
+void DrawingManager::Init(int numLeds, int splitPoint)
 {
     pLedStrip = new ledstrip(numLeds, splitPoint);
     Thread::wait(100);
@@ -21,18 +21,58 @@
     
 }
 
-char* DrawingManager::start(const unsigned char* cmdBuf, int cmdLen)
+void DrawingManager::Clear()
+{
+//    printf("CLEAR\r\n");
+    if (pLedStrip)
+        pLedStrip->Clear();
+}
+
+void DrawingManager::RawFill(char* args, unsigned char* payload, int payloadLen, int payloadOffset)
 {
-    if (!pLedStrip)
-        return "NOINIT";
-    if (isBusy)
-        return "BUSY";
-    isBusy = true;
-    char* respStr = cmdmsg::Interpret(cmdBuf, cmdLen, pLedStrip);
-    isBusy = false;
-    return respStr;
+//    printf("RAWFILL %s payloadLen %d, payloadOffset %d\r\n", args, payloadLen, payloadOffset);
+    int startLed = GetIntFromNameValPair(args, "start=", -1);
+    if (startLed != -1 && payloadLen > 0)
+    {
+        int numLeds = payloadLen / 3;
+        int fromLed = startLed + (payloadOffset / 3);
+//        printf("RAWFILL fromLed %d numLeds %d\r\n", fromLed, numLeds);
+        pLedStrip->RawFill(fromLed, numLeds, payload);
+    }
 }
 
-void DrawingManager::service()
+void DrawingManager::Fill(char* args)
 {
+//    printf("FILL %s\r\n", args);
+    int startLed = GetIntFromNameValPair(args, "start=", -1);
+    int numLeds = GetIntFromNameValPair(args, "len=", -1);
+    int r1 = GetIntFromNameValPair(args, "r1=", -1);
+    int g1 = GetIntFromNameValPair(args, "g1=", -1);
+    int b1 = GetIntFromNameValPair(args, "b1=", -1);
+    int r2 = GetIntFromNameValPair(args, "r2=", -1);
+    int g2 = GetIntFromNameValPair(args, "g2=", -1);
+    int b2 = GetIntFromNameValPair(args, "b2=", -1);
+    if (startLed != -1 && numLeds != -1 && r1 != -1 && g1 != -1 && b1 != -1)
+    {
+        if (r2 == -1 || g2 == -1 || b2 == -1)
+            pLedStrip->Fill(startLed, numLeds, r1, g1, b1);
+        else
+            pLedStrip->Fill(startLed, numLeds, r1, g1, b1, r2, g2, b2);
+    }
 }
+
+void DrawingManager::ShowLeds()
+{
+//    printf("SHOWLEDS\r\n");
+    if (pLedStrip)
+        pLedStrip->ShowLeds();
+}
+
+int DrawingManager::GetIntFromNameValPair(char* buf, char* name, int invalidVal)
+{
+    int val = invalidVal;
+    char* pFnd = strstr(buf, name);
+    if (pFnd)
+        val = atoi(pFnd + strlen(name));
+    return val;
+}