Mac addr added ICRS

Dependencies:   mbed

Fork of Email2Screen by Oliver Mattos

Revision:
0:1619a6b826d7
Child:
1:b38b745d1ea8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 21 18:25:34 2011 +0000
@@ -0,0 +1,85 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPClient.h"
+
+EthernetNetIf eth; 
+
+DigitalOut myled(LED1);
+BusOut RowOn(p26, p25, p24, p23);
+DigitalOut ST(p22);
+DigitalOut CK(p21);
+DigitalOut R2(p20);
+DigitalOut R1(p19);
+DigitalOut EN(p17);
+
+Timer timer;
+
+const int W=64;
+const int H=128;
+byte PenisData[ H*W/8 ];
+
+
+
+
+int main() {
+    EN = 0;
+    wait_us(1);
+    
+    timer.start();
+    
+    printf("\r\nSetting up...\r\n");
+    EthernetErr ethErr = eth.setup();
+    if(ethErr) {
+        printf("Error %d in setup.\n", ethErr);
+        return -1;
+    }
+    printf("\r\nSetup OK\r\n");
+
+    HTTPClient http;
+    HTTPStream stream;
+    
+    while (1) {
+        
+        stream.readNext(PenisData, sizeof(PenisData));
+        http.get("http://www.omattos.com/screen.php", &stream);
+        
+        //for (int m=0; m< H*W/8; m++) 
+        //  PenisData[m] = 0x55;
+          
+        printf("Data!\r\n");
+
+        timer.reset();
+        
+        int offset = 0;
+        
+        while(offset+16 < H){
+                    
+            // display a frame
+            for (int j = 0; j < 16; j++){
+                for (int i = 0; i < 64; i++){
+                    
+                    int X = i;
+                    int Y = j + offset;
+                    int addr = Y*W+X;
+                    R1 = R2 = ((PenisData[addr>>3]>>(addr & 7)) & 1);
+                    
+                    wait_us(1);
+                    CK = 1;
+                    wait_us(1);
+                    CK = 0;
+                }
+                EN = 0;
+                ST = 1;
+                wait_us(1);
+                ST = 0;
+                
+                RowOn = j;
+                EN = 1;
+                wait_us(500);
+            }
+            offset = (timer.read_ms()/100.0) - 9;
+            if (offset<0) offset=0;
+        }
+        EN = 0;  // switch the screen off while we get new data.
+    }
+}
\ No newline at end of file