nyní mám kód :
Kód: Vybrat vše
#include <SPI.h>
#include <EtherCard.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define STATIC 1 // set to 1 to disable DHCP (adjust myip/gwip values below)
#define pin 1
// nastavení komunikace senzoru přes pin
OneWire oneWire(pin);
// převedeme onewire do Dallasu
DallasTemperature sensors(&oneWire);
#if STATIC
// ethernet interface ip address
static byte myip[] = { 192,168,1,200 };
// gateway ip address
static byte gwip[] = { 192,168,1,1 };
#endif
// ethernet mac address - must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[500]; // tcp/ip send and receive buffer
const char page[] PROGMEM =
",n,mn,mn,mnm,n"
;
void setup(){
Serial.begin(57600);
Serial.println("\n[backSoon]");
sensors.begin();
// Change 'SS' to your Slave Select pin, if you arn't using the default pin
if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 0)
Serial.println( "Failed to access Ethernet controller");
#if STATIC
ether.staticSetup(myip, gwip);
#else
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
#endif
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
}
void loop(){
// wait for an incoming TCP packet, but ignore its contents
if (ether.packetLoop(ether.packetReceive())) {
memcpy_P(ether.tcpOffset(), page, sizeof page);
ether.httpServerReply(sizeof page - 1);
}
}
Vím že se ten text určuje tady,n,mn,mn,mnm,n
Ale já bych tam potřeboval dosadit :const char page[] PROGMEM =
",n,mn,mn,mnm,n"
;
Kód: Vybrat vše
"<!DOCTYPE html> <html>\n"
"<head><meta charset=\"UTF-8\" name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">\n"
"<link href=\"https://fonts.googleapis.com/css?family=Open+Sans:300,400,600\" rel=\"stylesheet\">\n"
"<title>Teploty</title>\n"
"<style>html { font-family: 'Open Sans', sans-serif; display: block; margin: 0px auto; text-align: center;color: #333333;}\n"
"body{margin-top: 50px;}\n"
"h1 {margin: 50px auto 30px;}\n"
".side-by-side{display: inline-block;vertical-align: middle;position: relative;}\n"
".humidity-icon{background-color: #3498db;width: 30px;height: 30px;border-radius: 50%;line-height: 36px;}\n"
".humidity-text{font-weight: 600;padding-left: 15px;font-size: 19px;width: 160px;text-align: left;}\n"
".humidity{font-weight: 300;font-size: 60px;color: #3498db;}\n"
".temperature-icon{background-color: #f39c12;width: 30px;height: 30px;border-radius: 50%;line-height: 40px;}\n"
".temperature-text{font-weight: 600;padding-left: 15px;font-size: 19px;width: 160px;text-align: left;}\n"
".temperature{font-weight: 300;font-size: 60px;color: #f39c12;}\n"
".superscript{font-size: 17px;font-weight: 600;position: absolute;right: -20px;top: 15px;}\n"
".data{padding: 10px;}\n"
"</style>\n"
"</head>\n"
"<body>\n"
"<div id=\"webpage\">\n"
"<h1 style=\"font-size : 60px\">Teploty u bazénu</h1>\n"
"<div class=\"data\">\n"
"<div class=\"side-by-side temperature-icon\">\n"
"<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n"
"width=\"9.915px\" height=\"22px\" viewBox=\"0 0 9.915 22\" enable-background=\"new 0 0 9.915 22\" xml:space=\"preserve\">\n"
"<path fill=\"#FFFFFF\" d=\"M3.498,0.53c0.377-0.331,0.877-0.501,1.374-0.527C5.697-0.04,6.522,0.421,6.924,1.142\n"
"c0.237,0.399,0.315,0.871,0.311,1.33C7.229,5.856,7.245,9.24,7.227,12.625c1.019,0.539,1.855,1.424,2.301,2.491\n"
"c0.491,1.163,0.518,2.514,0.062,3.693c-0.414,1.102-1.24,2.038-2.276,2.594c-1.056,0.583-2.331,0.743-3.501,0.463\n"
"c-1.417-0.323-2.659-1.314-3.3-2.617C0.014,18.26-0.115,17.104,0.1,16.022c0.296-1.443,1.274-2.717,2.58-3.394\n"
"c0.013-3.44,0-6.881,0.007-10.322C2.674,1.634,2.974,0.955,3.498,0.53z\"/>\n"
"</svg>\n"
"</div>\n"
"<div class=\"side-by-side temperature-text\">Teplota vzduchu</div>\n"
"<div class=\"side-by-side temperature\">"
//(int)Temperature
// (sensors.getTempCByIndex(0))
"<span class=\"superscript\">°C</span></div>\n"
"</div>\n"
"<div class=\"data\">\n"
"<div class=\"side-by-side temperature-icon\">\n"
"<svg version=\"1.1\" id=\"Layer_2\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n"
"width=\"9.915px\" height=\"22px\" viewBox=\"0 0 9.915 22\" enable-background=\"new 0 0 9.915 22\" xml:space=\"preserve\">\n"
"<path fill=\"#FFFFFF\" d=\"M3.498,0.53c0.377-0.331,0.877-0.501,1.374-0.527C5.697-0.04,6.522,0.421,6.924,1.142\n"
"c0.237,0.399,0.315,0.871,0.311,1.33C7.229,5.856,7.245,9.24,7.227,12.625c1.019,0.539,1.855,1.424,2.301,2.491\n"
"c0.491,1.163,0.518,2.514,0.062,3.693c-0.414,1.102-1.24,2.038-2.276,2.594c-1.056,0.583-2.331,0.743-3.501,0.463\n"
"c-1.417-0.323-2.659-1.314-3.3-2.617C0.014,18.26-0.115,17.104,0.1,16.022c0.296-1.443,1.274-2.717,2.58-3.394\n"
"c0.013-3.44,0-6.881,0.007-10.322C2.674,1.634,2.974,0.955,3.498,0.53z\"/>\n"
"</svg>\n"
"</div>\n"
"<div class=\"side-by-side temperature-text\">Teplota vody</div>\n"
"<div class=\"side-by-side temperature\">"
// (int)voda
"<span class=\"superscript\">°C</span></div>\n"
"</div>\n"
"<div class=\"data\">\n"
"<div class=\"side-by-side temperature-icon\">\n"
"<svg version=\"1.1\" id=\"Layer_2\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n"
"width=\"9.915px\" height=\"22px\" viewBox=\"0 0 9.915 22\" enable-background=\"new 0 0 9.915 22\" xml:space=\"preserve\">\n"
"<path fill=\"#FFFFFF\" d=\"M3.498,0.53c0.377-0.331,0.877-0.501,1.374-0.527C5.697-0.04,6.522,0.421,6.924,1.142\n"
"c0.237,0.399,0.315,0.871,0.311,1.33C7.229,5.856,7.245,9.24,7.227,12.625c1.019,0.539,1.855,1.424,2.301,2.491\n"
"c0.491,1.163,0.518,2.514,0.062,3.693c-0.414,1.102-1.24,2.038-2.276,2.594c-1.056,0.583-2.331,0.743-3.501,0.463\n"
"c-1.417-0.323-2.659-1.314-3.3-2.617C0.014,18.26-0.115,17.104,0.1,16.022c0.296-1.443,1.274-2.717,2.58-3.394\n"
"c0.013-3.44,0-6.881,0.007-10.322C2.674,1.634,2.974,0.955,3.498,0.53z\"/>\n"
"</svg>\n"
"</div>\n"
"<div class=\"side-by-side temperature-text\">Teplota v přepadu</div>\n"
"<div class=\"side-by-side temperature\">"
// (int)okap
"<span class=\"superscript\">°C</span></div>\n"
"</div>\n"
"</body>\n"
"</html>\n"