Oliver Mattos
/
Email2Screen
qwerty
main.cpp
- Committer:
- Hello1024
- Date:
- 2011-11-21
- Revision:
- 0:1619a6b826d7
File content as of revision 0:1619a6b826d7:
#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. } }