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.
Dependencies: DS1820 SDFileSystem SLCD WIZnet_Library mbed
Diff: main.h
- Revision:
- 0:d02fb9a8c1ae
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.h Thu Oct 16 09:36:53 2014 +0000
@@ -0,0 +1,213 @@
+#include "mbed.h"
+#include "WIZnetInterface.h"
+#define ECHO_SERVER_PORT 80
+
+
+//******************
+#define MULTIPLE_PROBES
+#define DATA_PIN PTC10 //1wire
+
+
+
+#include "SerialBase.h"
+#include "mbed.h"
+#include "DS1820.h"
+#include "SLCD.h"
+#include "Serial.h"
+#define MAX_PROBES 64
+#define BAUD (115200)
+#include "SDFileSystem.h"
+
+char zp;
+char zpp[1001];
+int tt;
+//int ustaw;
+char data[8];
+char data_all[600]; //="komarowski";
+int data_rozmiar=599;
+int data_rozmiar2=599;
+int lenght;
+char zzpp[1001];
+
+
+DigitalOut myled(LED1);//PTD5
+DigitalOut myled2(LED2); //PTE29
+DigitalOut SD_SEL(PTA12);
+
+DigitalIn sw1(PTC3); //if(sw1) Release else Press
+DigitalIn sw3(PTC12); //while(sw3); wait for Press
+//DigitalIn sw4(PTD5);//dioda czerwona
+//DigitalIn sw5(PTE29);//dioda czerwona
+
+SLCD slcd;
+DS1820* probe[MAX_PROBES];
+
+
+SPI spi(PTD6, PTD7, PTD5); // mosi, miso, sclk
+WIZnetInterface eth(&spi, PTD4, PTA20); // spi, cs, reset
+SDFileSystem sd(PTD6, PTD7, PTD5, PTA4, "sd"); // MOSI, MISO, SCLK, SSEL
+
+Serial pc(PTA2,PTA1);
+DigitalOut led(PTB0);
+
+char a[]={"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nPragma: no-cache\r\n\r\n"};
+char aa[]={"HTTP/1.0 200 OK\r\nContent-Type: image/jpeg\r\nPragma: no-cache\r\n"};
+//char aa[]={"HTTP/1.0 200 OK\r\nContent-Type: image/jpg\r\nPragma: no-cache\r\n\r\n"};
+char b[]={"<html>\r\n<body>\r\n"};
+char bb[]={"<html>\r\n<body>\r\n"};
+//char ab[]={"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nPragma: no-cache\r\n\r\n"};
+//char b[]={"<meta http-equiv=refresh content=1>"};
+//char b[]={"<html>\r\n<body>\r\n"};
+char c[]={"<body bgcolor=\"green\">"};
+char c1[]={"<body bgcolor=\"000ff0\"></body>\r\n"};
+char d[]={"<H2>Test W5100 i DS18b20</H2>"};
+char e[]={"<form action=\"http://10.192.144.204/d\"><input type=\"submit\" value=\"Wylacz LED2\" /></form>"};
+char f[]={""};
+char g[]={"<form action=\"http://10.192.144.204/c\"><input type=\"submit\" value=\"Wlacz LED 2\" /></form>"};
+char h[]={"<H1>__________</H1>"};
+char i[]={"<form action=\"http://10.192.144.204/bb\"><input type=\"submit\" value=\"Wylacz LED1\" /></form>"};
+char j[]={"_"};
+char k[]={"<form action=\"http://10.192.144.204/aa\"><input type=\"submit\" value=\"Wlacz LED1\" /></form>"};
+char l[]={"<form action=http://10.192.144.204 method=post onsubmit><input type=text name=tekst /><input type=submit value=OK /></form>"};
+char m[]={"Temp"};
+//if (this.tekst2.value == '') { alert('Zanim wyślesz formularz, musisz wypełnić pole tekstem!'); return false }><input type=text name=tekst /><input type=submit value=OK /></form>"};
+//char g[]={"<FONT FACE=\"Arial\" SIZE=\"8\" COLOR=\"FF0000\">"};
+//char w[]={"<meta http-equiv=\"refresh\" content=\"10; url=/\">\r\n"};
+//char g[]={"<center><h2>Tutaj jestes -01 :)</h2>\r\n"};
+//char h[]={"<center><div STYLE=\"position:absolute;bgcolor:black; top:100px; left:200px;width:54px\">"};
+//char i[]={"<center><h2>Tutaj jestes :)</h2>\r\n"};
+//char s[]={"Content-Type: text/html\r\n"};
+char t[]={"Connection: close\r\n\r\n"};
+//char u[]={"Refresh content=5\r\n\r\n"};
+//char u[]={"<meta http-equiv=refresh content=1>"};
+//char v[]={"<!DOCTYOE HTML>\r\n"};
+//char y[]={"<html>\r\n"};
+
+
+char paq_en[128];
+
+
+void temperatura_f()
+{
+
+ int num_devices = 0;
+ while(DS1820::unassignedProbe(DATA_PIN))
+ {
+ probe[num_devices] = new DS1820(DATA_PIN);
+ num_devices++;
+ if (num_devices == MAX_PROBES)
+ break;
+ }
+}
+
+
+
+void odczyt_z_SD(TCPSocketConnection client, int ustaw)
+{
+ FILE *zw;
+ if(strstr(data_all, "zmiana")!=0)
+ zw = fopen("/sd/index_old.htm","r");
+ else
+ zw = fopen("/sd/index.htm","r");
+
+ if(zw==NULL)
+ {
+ printf("plik jest pusty, lub nie istnieje");
+ }
+ zp=0;
+ tt=0;
+
+ while(1) // aż napotka pusty znak
+ {
+ zp=fgetc(zw); // czytanie z pliku
+ if(feof(zw))//wychodzi z pętli gdy napotka nie zapisaną komórkę
+ break;
+
+ zpp[tt]=zp;
+ tt++;
+ if (tt==1000)
+ {
+ if (ustaw==1)
+ {
+ client.send(zpp,1001);
+ //zpp[1000]=0;
+ // printf("\r\n Wyslal \r\n %s",zpp);
+ }
+ else if (ustaw==2)
+ {
+ printf("\r\n Wyslal \r\n %s",zpp);
+ }
+
+ zpp[0]=0;//zerowanie tablicy
+ tt=0;
+ }
+ }
+
+ // tt=0;
+ zpp[tt]=0;
+ if (ustaw==1)
+ {
+ client.send(zpp,tt);
+ // printf("\n Doslal \r\n %s",zpp);
+ }
+ else if (ustaw==2)
+ {
+
+
+ printf("\n Doslal \r\n %s",zpp);
+ }
+
+ zpp[0]=0;//zerowanie tablicy
+
+ fclose(zw);
+
+}
+
+void diody()
+{
+
+ //zmiena dla funkcji POST
+ printf("%s ",a);
+ if (strstr(data_all,"komarowski") !=0)
+ {
+ myled2=0;
+ }
+ else if (strstr(data_all,"wotlinski") !=0)
+ {
+ myled2=1;
+ }
+ else if (strstr(data_all,"obojski") !=0)
+ {
+ myled2=!myled2;
+ }
+
+ //zmienne dla funkcji GET
+
+ if (data_all[6]=='a')
+ {
+ myled=0;
+ pc.printf("\r\n Myled=0");
+ }
+ else if (data_all[6]=='b')
+ {
+ myled=1;
+ pc.printf("\r\n Myled=1");
+ }
+
+ if (data_all[5]=='c')
+ {
+ myled2=0;
+ pc.printf("\r\n Myled2=0");
+ }
+ else if (data_all[5]=='d')
+ {
+ myled2=1;
+ pc.printf("\r\n Myled2=1");
+ }
+
+
+}
+
+
+
+//*******załącza i wyłącza diody