Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Email2Screen by
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetNetIf.h" 00003 #include "HTTPClient.h" 00004 00005 EthernetNetIf eth; 00006 00007 DigitalOut myled(LED1); 00008 BusOut RowOn(p26, p25, p24, p23); 00009 DigitalOut ST(p22); 00010 DigitalOut CK(p21); 00011 DigitalOut R2(p20); 00012 DigitalOut R1(p19); 00013 DigitalOut EN(p17); 00014 00015 Timer timer; 00016 00017 const int W=64; 00018 const int H=128; 00019 byte PenisData[ H*W/8 ]; 00020 00021 extern "C" void mbed_mac_address(char * mac) { 00022 00023 // define your own MAC Address 00024 mac[0] = 0x8C; 00025 mac[1] = 0x70; 00026 mac[2] = 0x5A; 00027 mac[3] = 0xD4; 00028 mac[4] = 0x96; 00029 mac[5] = 0xC4; 00030 00031 }; 00032 00033 00034 00035 00036 int main() { 00037 EN = 0; 00038 wait_us(1); 00039 00040 00041 timer.start(); 00042 00043 printf("\r\nSetting up...\r\n"); 00044 EthernetErr ethErr = eth.setup(); 00045 if(ethErr) { 00046 // printf("Error %d in setup.\n", ethErr); 00047 // return -1; 00048 int myint = int(ethErr); 00049 while(myint>0){ 00050 myled = 1; 00051 wait(1); 00052 myled =0; 00053 wait(1); 00054 myint--; 00055 } 00056 } 00057 printf("\r\nSetup OK\r\n"); 00058 00059 HTTPClient http; 00060 HTTPStream stream; 00061 00062 while (1) { 00063 00064 stream.readNext(PenisData, sizeof(PenisData)); 00065 http.get("http://www.omattos.com/screen.php", &stream); 00066 00067 //for (int m=0; m< H*W/8; m++) 00068 // PenisData[m] = 0x55; 00069 00070 printf("Data!\r\n"); 00071 00072 timer.reset(); 00073 00074 int offset = 0; 00075 00076 while(offset+16 < H){ 00077 00078 // display a frame 00079 for (int j = 0; j < 16; j++){ 00080 for (int i = 0; i < 64; i++){ 00081 00082 int X = i; 00083 int Y = j + offset; 00084 int addr = Y*W+X; 00085 R1 = R2 = ((PenisData[addr>>3]>>(addr & 7)) & 1); 00086 00087 wait_us(1); 00088 CK = 1; 00089 wait_us(1); 00090 CK = 0; 00091 } 00092 EN = 0; 00093 ST = 1; 00094 wait_us(1); 00095 ST = 0; 00096 00097 RowOn = j; 00098 EN = 1; 00099 wait_us(500); 00100 } 00101 offset = (timer.read_ms()/100.0) - 9; 00102 if (offset<0) offset=0; 00103 } 00104 EN = 0; // switch the screen off while we get new data. 00105 } 00106 }
Generated on Tue Jul 12 2022 14:12:35 by
1.7.2
