このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


The code for first ArduServer, a simple web server in an Arduino with an ENC28J60 ethernet interface- a5as1code OVERALL HOME    Other 構成要素 for programmers, not Arduino 明確な/細部
ARDUINO: 最高の,を越す Page    支店 "A": Arduino Course    支店 "B": Arduino "How To"s and 事業/計画(する)s
ArduServer and AdruSimpSrv: HOME
-d- Bookmark this on Delicious   Recommend to StumbleUpon

Arduino as web server with an ENC28J60: ArduServe

The Sourcecode

Input and 生産(高) 地元で or across the internet

This page is browser friendly, by the way. Make your browser's window いっそう少なく wide than your whole 審査する and you will find the narrower columns much easier to read. For more tips, see my 力/強力にする Browsing hints.

This page is not(?) enough

I 堅固に recommend that you at least skim through the (警察などへの)密告,告訴(状) on my page about how this code was developed, but if you want just "the answer", here it is. At least here is the Arduino half of things. You use an ordinary web browser, e.g. Firefox, for the (弁護士の)依頼人. You can 接近 an ArduServer over your LAN or across the internet.


ArduServe with ENC28J60....

(This page was started in 2011. Please see my "March 2015 ENC28J60 update" page before buying or using one of them! (That page will open in a new tab. Just の近くに it to come 支援する here.))

You will have to change one line if you don't want to use port 80.

You will have to change a second line if you want 接近 across the internet, or if you 港/避難所't put your ArduServer on 192.168.0.240 and are happy with mere LAN 接近.

If your LED is not on D8, and your phototransistor on A3, there will be other simple, 選び出す/独身-line changes to make. The "beeper" for 報告(する)/憶測ing a visit by a (弁護士の)依頼人 goes on D8. (The 金物類/武器類 for the beeper should have a built in oscillator... as long as D8 is high, the sound should continue.)

Other than that, it should Just Work... if your interface is the ENC28J60. If you don't know, you may 井戸/弁護士席 have a W5100.

STOP PRESS: It seems that maybe there's an element of bad advice in some of the pages this is associated with.

It may be a bad idea to use any of the に引き続いて at the same time as a W5100 based 保護物,者....

... and D13, but this last one only if you "care" that on the 保護物,者 it goes to an LED, and from there through a resistor to ground. (This 単に 平行のs the same thing on many Arduino and clone boards... BUT, to digress from the digression, BE AWARE that the ソフトウェア behind "体制/機構()" and "宙返り飛行()" pulse D13 high 簡潔に before 遂行する/発効させるing whatever you 明示するd in "体制/機構()".)

While the ソフトウェア this page is about is for the ENC28J60, the day may come when you wish to 移転 the 事業/計画(する) to W5100 based 金物類/武器類. As long as you use the ENC28J60, on the NuElectronics 保護物,者 anyway, you only need to 避ける D2 and D10-13. The 保護物,者 also connect to ground, of course. It draws 5v from the main board, and has a 関係 to the reset line. (I 現実に had an ArduServer working 罰金 for a few months with no 関係 to D2, but a re-examination of the schematic 示唆するs that I せねばならない have a 関係 there. It is an 生産(高) from the 保護物,者. Who knows what the ethernet library wants to see coming on on D2, but I'm not leaving the signal to chance.)

The ArduServer's 金物類/武器類 and ソフトウェア (from ver of 24Oct11) have been "昇格d" to 尊敬(する)・点 these new design goals.

修正するing the ソフトウェア was 平易な.

To change the line used for, say, the phototransistor watching the LED in the line....

int8_t sensorPin = A1;  // 指定する the input pin for a sensor... a phototransistor used in example

...was changed to...

int8_t sensorPin = A3;  // 指定する the input pin for a sensor... a phototransistor used in example

... and that was all that was needed. I hadn't "planned" to need to change the 配分 of the sensor to that analog input... but 令状ing the code that way was just a 事柄 of good programming. (I had to move one wire on your breadboard, too, of course, to move on from the 初めの design.)

Sorry! I could have done without this, too! When will the 公式の/役人 Arduino 場所/位置 have proper documentation of the ethernet 保護物,者 and library??


The Arduino Sourcecode....

//ArduServer1

//N.B.: AT LEAST myport, myip, and baseurl[] probably need changing between
//what you download, and what you need for your circumstances.

/*See 発言/述べる a few lines below here for source of 権利 library

This ソフトウェア discussed in tutorial...
http://sheepdogguides.com/arduino/art5serv.htm*/

#含む "etherShield.h"

static char ver[]="23Oct11";// KEEP THIS SHORT! I goes into the webpage xxx,
//and space is VERY 限られた/立憲的な.
//SEE ALSO place その上の 負かす/撃墜する where, for now, "ver" info has to be entered
//a second time. Sigh. TO DO: Find way to have ver taken from the array, so
//手渡す-(re)-coding lower 負かす/撃墜する not necessary.

/*金物類/武器類 必要物/必要条件s....

For NuElectronics END28J60 Ethernet 保護物,者:

D2 (I 現実に had an Arduserver working 罰金 for a few months with no
         関係 to D2, but a re-examination of the schematic 示唆するs
         that I せねばならない have a 関係 there. It is an 生産(高) from the
         保護物,者. Who knows what the ethernet library wants to see coming
         on on D2, but I'm not leaving the signal to chance.)
D10-13
Reset
Gnd
5v (Into the 保護物,者)

For the "features" of ArduServer:
Two 数字表示式の 生産(高)s. I am using...
  D7 for the "beep" that 発表するs an 接近 of the server
  D8 for the LED which (弁護士の)依頼人s can turn on or off
One analog input. I am using An3

Other pins have been 避けるd to keep the 金物類/武器類
  here the same as other systems from the same
  author, but using Wiznet 5100 interfaces

*/

/*Around since at least 17Apr2011

Derived from the example, "ethershield_webserver.pde"
供給(する)d with the necessary library "etherShield". The デモ
"ethershield_web_temperature.pde" was 必須の to me in
"getting to the next level" and FINALLY mastering creating
and using buttons. It also has some useful code, not
会社にする/組み込むd here, which would 許す you to attach a
Dallas 1-Wire 気温 sensor to your ArduServer, so
that the webpage served could 報告(する)/憶測 a 気温.

The library comes from
http://www.nuelectronics.com/download/事業/計画(する)s/etherShield.zip

Info on using libraries 含むd in tutorial 特記する/引用するd at 最高の,を越す

Changes to the program (not the library) were done by TK Boyd, of
http://sheepdogsoftware.co.uk

*/

/*==============
Define the MAC 演説(する)/住所 the 装置 will 現在の to the LAN.
  All MAC 演説(する)/住所s on a given LAN must be different from each other.
  公式文書,認める: The values are separated with commas. */

//uint8_t: Unsigned 8 bit datum. And array of them, in this 事例/患者...
static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};

/*Define the IP 演説(する)/住所 the 装置 will 答える/応じる to on the LAN.
  All IP 演説(する)/住所s on a given LAN must be unique.
  公式文書,認める: The values are separated with commas.
  This should be the LOCAL 演説(する)/住所 of the 装置, i.e.
  its 演説(する)/住所 on the LAN it lives on, something like
  192,168,0,240*/

static uint8_t myip[4] = {192,168,0,240};//Commas here... 十分な stops
  //usually, in other 状況s.

/*Define the port your server will use. 普通は, you would 選ぶ for
  port 80, but others are possible, if you know what you are doing.
  If you use, say, 81, 追加する :81 to what you put into your browser
  to 接近 the server. It may be that you should not use a port
  outside of the 範囲 1-254... see 公式文書,認める at "mywwwport"*/

unsigned int myport=81;//80 will be 罰金 for most people. TKB needs 81 at 7NC

/* To use this code for a server accessible only on your LAN,
   you would make the に引き続いて "http://192.168.0.240" if you
   献身的な that IP 演説(する)/住所 of your LAN to the server.

   If you want your ArduServer to be "seen" from anywhere on the
   internet (or on your LAN) 取って代わる the digits with the URL for
   your system. In my 事例/患者, for example, I would use...
      http://mon7nc.dyndns.org

   Once upon a time, if you were using a 非,不,無-基準 port, i.e.
   a port other than 80, you put that on the end of the baseurl.
   This is no longer true. Put JUST the URL for your
   ArduServer in the に引き続いて variable. (The port specification
   will be appended by the ソフトウェア.)

   You WILL need to append the port specification each time you
   first 接近 the server from a browser, but the result of
   clicking on "LED On" or "LED Off" will have the port number
   追加するd automatically.

*/

static char baseurl[]="http://mon7nc.dyndns.org";
char portasstring[5];//5 to 融通する port numbers of up to 9999
  //portasstring is filled during 体制/機構().

//======================================================
//Page 衝撃を和らげるもの....

/*You may need to change the 衝撃を和らげるもの size... if you change
  the 量 of text on the webpage served, or the 量
  of code in your 見解/翻訳/版 of the program.

  N.B.: The size of the 衝撃を和らげるもの is fussy... too big or too small, and
  you will get hard-to-debug problems. (Worst 事例/患者: The code 収集するs
  and runs, but when you ask for the page it is meant to serve, the
  (弁護士の)依頼人 waits and waits until the browser times out.

  Make the 衝撃を和らげるもの too (unnecessarily) big, and you 減ずる the 量
  of code you can 挿入する to 追加する Good Stuff to your ArduServer
  without getting any 利益 from the over-large 衝撃を和らげるもの.

  Make the 衝撃を和らげるもの too small, and I think you will 遭遇(する) over-run
  and 衝突,墜落 the server.

  I believe that if you 追加する enough text to the page 存在 served,
  you have to 増加する the 衝撃を和らげるもの size.

  There may also be another 限界 to the 量 of text which can
  be on a served page, but I'm not sure about this yet.

  "Text" in both 事例/患者s discussed above 含むs the HTML tags.*/

#define BUFFER_SIZE 680
static uint8_t buf[BUFFER_SIZE+1];

//The に引き続いて does NOT have to be changed, even if you've
//   changed MAC 演説(する)/住所, IP 演説(する)/住所 or port.
static uint16_t mywwwport =myport; // listen port for tcp/www (max 範囲 1-254)

#define STR_BUFFER_SIZE 22
static char strbuf[STR_BUFFER_SIZE+1];

EtherShield es=EtherShield();

//追加するd by sheepdogsoftware.co.uk...

//For the inputs and 生産(高)s 拡張 of the デモ...
int8_t bTmp;            //For misc chores
int8_t sensorPin = A3;  // 指定する the input pin for a sensor... a phototransistor used in example
   //"A3" is a funny sort of "number"... but it is 始める,決める to what we need by things 深い inside
   //the Arduino IDE.
in example
int8_t ledPin = 8;      // 指定する the pin for an 生産(高)... LED used in example
int8_t beepPin = 7;     // 指定する the pin to 運動 "beep" which will 示す a request's arrival.
int sensorValue = 0;    // variable to 蓄える/店 the value coming from the sensor
unsigned int iClicks=0; // 0-65,535. Variable to 蓄える/店 number of requests made to server since most 最近の reboot.

//end, a 封鎖する of new lines by TKB of sheepdogsoftware.co.uk

//The next two lines puzzle me, TKB. But even though I don't believe
//   they are doing what the 初めの 発言/述べる says, they do no 害(を与える),
//   and may be doing good, so I left them!

// 準備する the webpage by 令状ing the data to the tcp send 衝撃を和らげるもの
uint16_t print_webpage(uint8_t *buf);
int8_t analyse_cmd(char *str);


/* ============  体制/機構() =============================== */
無効の 体制/機構(){

//You can 挿入する your own code here....


//....to initialize things for features you have 追加するd.

/*Here begins bits 追加するd by sheepdogsoftware.co.uk...
  For the inputs and 生産(高)s 拡張 of the デモ...*/
// 宣言する ledPin, beepPin as OUTPUTs, and 始める,決める 初期の 明言する/公表するs:
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin,LOW);//設立する 初期の 明言する/公表する: LED off.

  pinMode(beepPin, OUTPUT);
  digitalWrite(beepPin,LOW);//設立する 初期の 明言する/公表する: No beep.

//(Input will be over sensorPin, which doesn't need initializing.)

//移転 myport (the number) to portasstring (an array of
//   bytes, 終結させるd by 0)... If port is 80, the ASCII for "8"
//   should be in the first byte of the array.

//There is probably a better way to fill the array, but this 作品!

//Setting myport=1234 doesn't result in a 実験(する) which is easily 監視するd.
//If myport=1234, then after the に引き続いて, portasstring[0] should be the ASCII
//   for 1, portastring[1] should be ASCII 2, etc... AND after the last
//   the next element of portasstring should 持つ/拘留する the NUMBER 無.
//See also "81" example, below.
bTmp=0;
if (myport>999)
   {portasstring[bTmp]=((myport % 10000) / 1000) +48;
   ++bTmp;};
if (myport>99)
   {portasstring[bTmp]=((myport % 1000) / 100) +48;
   ++bTmp;};
if (myport>9)
   {portasstring[bTmp]=((myport % 100) / 10) +48;
   ++bTmp;};
//And then do the always true 事例/患者: if (myport>0)...
   portasstring[bTmp]=(myport % 10)+48;
   ++bTmp;
//And tack on a 無 to 終結させる string...
   portasstring[bTmp]=0;

//As a その上の example: To fill portasstring with "81", you would use...
//portasstring[bTmp]='8';
//portasstring[1]='1';
//portasstring[2]=0;//終結させる with 0

//Change 宣言 of portasstring 近づく start of program
//if a port higher than 9999 is 要求するd.

//End of bits 追加するd here by sheepdogsoftware.co.uk




/* HERE BEGINS code from NuElectronics web server デモ*/

//initialize enc28j60
es.ES_enc28j60Init(mymac);
es.ES_enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz
延期する(10);

/* Magjack LEDs configuration, see enc28j60 datasheet, page 11 */
// LEDA=green LEDB=yellow
//
// 0x880 is PHLCON LEDB=on, LEDA=on
// enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x880);
延期する(500);
//
// 0x990 is PHLCON LEDB=off, LEDA=off
// enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x990);
延期する(500);
//
// 0x880 is PHLCON LEDB=on, LEDA=on
// enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x880);
延期する(500);
//
// 0x990 is PHLCON LEDB=off, LEDA=off
// enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x990);
延期する(500);

// 0x476 is PHLCON LEDA=links status, LEDB=receive/送信する/伝染させる
// enc28j60PhyWrite(PHLCON,0b0000 0100 0111 01 10);
es.ES_enc28j60PhyWrite(PHLCON,0x476);
延期する(100);

//init the ethernet/ip 層:
es.ES_init_ip_arp_udp_tcp(mymac,myip,myport);

}// end "体制/機構()"


/* ============  宙返り飛行() =============================== */
無効の 宙返り飛行(){

/*You can 挿入する your own code here, to 器具/実施する extra
     features of your own. Your code should not take long
     to 遂行する/発効させる, and it certainly should not "封鎖する"
     the 加工業者.

You CAN (in fact I will!) 追加する things in other places... but
     the chance of messing up the web serving is greater.*/


//End of best area for 追加するing your own code.


/* HERE BEGINS code of "宙返り飛行()" from NuElectronics
  web server デモ*/

uint16_t plen, dat_p;
int8_t cmd;

plen = es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf);

//plen will be NOT equal to 無 if there is a valid packet (without CRC error)
if(plen!=0){

  // arp is broadcast if unknown but a host may also 立証する the mac 演説(する)/住所
  //      by sending it to a unicast 演説(する)/住所.
  if(es.ES_eth_type_is_arp_and_my_ip(buf,plen)){
    es.ES_make_arp_answer_from_request(buf);
    return;
  }

  // check if ip packets are for us:
  if(es.ES_eth_type_is_ip_and_my_ip(buf,plen)==0){
    return;
  }

  if(buf[IP_PROTO_P]==IP_PROTO_ICMP_V && buf[ICMP_TYPE_P]==ICMP_TYPE_ECHOREQUEST_V){
    es.ES_make_echo_reply_from_request(buf,plen);
    return;
  }

  // tcp port www start, compare only the lower byte
  if (buf[IP_PROTO_P]==IP_PROTO_TCP_V&&buf[TCP_DST_PORT_H_P]==0&&buf[TCP_DST_PORT_L_P]==mywwwport){
    if (buf[TCP_FLAGS_P] & TCP_FLAGS_SYN_V){
       es.ES_make_tcp_synack_from_syn(buf); // make_tcp_synack_from_syn does already send the syn, ack
       return;
    }
    if (buf[TCP_FLAGS_P] & TCP_FLAGS_ACK_V){
      es.ES_init_len_info(buf); // init some data structures
      dat_p=es.ES_get_tcp_data_pointer();
      if (dat_p==0){ // we can かもしれない have no data, just ack:
        if (buf[TCP_FLAGS_P] & TCP_FLAGS_FIN_V){
          es.ES_make_tcp_ack_from_any(buf);
        }
        return;
      }
      if (strncmp("GET ",(char *)&(buf[dat_p]),4)!=0){
        	// 長,率いる, 地位,任命する and other methods for possible status codes see:
          // http://www.w3.org/議定書s/rfc2616/rfc2616-sec10.html
          plen=es.ES_fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 承認する\r\nContent-Type: text/html\r\n\r\n<h1>200 承認する</h1>"));
          goto SENDTCP;
      }
	if (strncmp("/ ",(char *)&(buf[dat_p+4]),2)==0){
              plen=print_webpage(buf);
          goto SENDTCP;
       }
      cmd=analyse_cmd((char *)&(buf[dat_p+5]));

/*Here we have a MAJOR "little tweak...." The "命令(する) 扱うing" code altered.
  See http://sheepdogguides.com/arduino/art5serv.htm
  */

//ORIGINAL: 封鎖する starting... if (cmd==1){   .... became
             if ((cmd==1)||(cmd==2)){ //TKB 見解/翻訳/版
             if (cmd==1)
               {LEDOnOff(0);延期する(100);}
               else
               {LEDOnOff(1);延期する(100);};
//"Tweak" ends. 避ける 挿入するing 延期するs such as the tiny ones you
//    see here, which aren't, I hope, big enough to 傷つける the 操作/手術
//    of the server, but give the LED time to come on or go off
//    before the light level sensor is read, どこかよそで.

             plen=print_webpage(buf);
        }
SENDTCP:  es.ES_make_tcp_ack_from_any(buf); // send ack for http get
           es.ES_make_tcp_ack_with_data(buf,plen); // send data
      }
    }
  }

}//end of "宙返り飛行()"



/*============ Subordinate subroutines, from NuElectronics デモ ===== */

uint8_t find_key_val(char *str,char *重要な){
// The returned value is 蓄える/店d in the 全世界の var strbuf

    uint8_t 設立する=0;
    uint8_t i=0;
    char *kp;
    kp=重要な;
    while(*str &&  *str!=' ' && 設立する==0){
            if (*str == *kp){
                    kp++;
                    if (*kp == '\0'){
                            str++;
                            kp=重要な;
                            if (*str == '='){
                                    設立する=1;
                            }
                    }
            }else{
                    kp=重要な;
            }
            str++;
    }
    if (設立する==1){
            // copy the value to a 衝撃を和らげるもの and 終結させる it with '\0'
            while(*str &&  *str!=' ' && *str!='&' && i<STR_BUFFER_SIZE){
                    strbuf[i]=*str;
                    i++;
                    str++;
            }
            strbuf[i]='\0';
    }
    return(設立する);
}// end of "find_key_val()"


/*==========================*/
int8_t analyse_cmd(char *str)
{
int8_t r=-1;

if (find_key_val(str,"cmd")){
    if (*strbuf < 0x3a && *strbuf > 0x2f){
            // is a ASCII number, return it
            r=(*strbuf-0x30);
    }
}
return r;
}// end of "analyse_cmd()"


/* ============  PRINT WEB PAGE ==================*/
/* You make changes within this subroutine to change
   what your webserver serves up to the world.

   Be careful about what you do here...
   Make changes incrementally, a bit at a time.

   The page must be keep disappointingly small in
   an Atmega 168. I would be 利益/興味d in what
   you find with a bigger 半導体素子.                  */

uint16_t print_webpage(uint8_t *buf)

{
/*新規加入s by sheepdogsoftware.co.uk...
     追加するd a bit "深い" in the program, but put here so that
     page returned 反映するs 明言する/公表する of sensor AFTER LED 明言する/公表する
     changed by "命令(する)" handler.... */

/*延期する to let LED finish going on or off is already 会社にする/組み込むd,
    at point LED 明言する/公表する may change. */

sensorValue = analogRead(sensorPin);

char temp_string[10];
int i=0;
int i2;
unsigned int iTmp;

uint16_t plen;

plen=es.ES_fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 承認する\r\nContent-Type: text/html\r\n\r\n"));//51 chars here.. incl 6 "escape "\"s
//                                     ^--- start of fifty one....                end...^
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<中心>"));//TEMP</h1>

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h2>Visit <a href=\"http://arduserver.com\" 的=\"_blank\">ArduServer.com<a> for explanation.<br>"));

//Won't work... try to find way to do this.... plen=es.ES_fill_tcp_data_p(buf,plen,PSTR(ver));
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("v.23 Oct 11"));//挿入する 見解/翻訳/版 ID in page. See "ver" at 最高の,を越す of page
//Previous is 天然のまま "解答" to what should be done by the line above it.

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</h2>"));

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<hr><form METHOD=get 活動/戦闘=\""));
plen=es.ES_fill_tcp_data(buf,plen,baseurl);
plen=es.ES_fill_tcp_data(buf,plen,":");  //Begin specification of port, in 事例/患者 not...
plen=es.ES_fill_tcp_data(buf,plen,portasstring);  // ...default port 80. One of two instances
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("\">"));

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h2>Clicks: </h2>"));
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h1><font color=\"#22FF00\">"));

//Put a number in the 生産(高) 衝撃を和らげるもの...

//初めは, a 無作為の number...

//temp_string[0]=48+無作為の(1,8);
//temp_string[1]=48+無作為の(1,8);
//temp_string[2]=48+無作為の(1,8);
//temp_string[3]=0;

//But now the value in iClicks, the number of server requests
//   扱うd since the last reset of the server.

//The code is CRUDE... but it 作品!
//I won't be 感情を害する/違反するd if someone 令状s me
//   to tell me the 権利 way to do this,
//   as long as the 権利 way is transparent
//   for newbies.
temp_string[0]=32;
temp_string[1]=32;
temp_string[2]=32;
temp_string[3]=32;
temp_string[4]=48;
temp_string[5]=0;

//iClicks=65123;//To 実験(する)

if (iClicks>9999)
   {iTmp=(iClicks / 10000) % 10;
   temp_string[0]=48+iTmp;};
if (iClicks>999)
   {iTmp=(iClicks / 1000) % 10;
   temp_string[1]=48+iTmp;};
if (iClicks>99)
   {iTmp=(iClicks / 100) % 10;
   temp_string[2]=48+iTmp;};
if (iClicks>9)
   {iTmp=(iClicks / 10) % 10;
   temp_string[3]=48+iTmp;};
if (iClicks>0)
   {iTmp=iClicks % 10;
   temp_string[4]=48+iTmp;};
//End of "put a number in the 生産(高) 衝撃を和らげるもの"

i=0;
 while (temp_string[i]) {
         buf[TCP_CHECKSUM_L_P+3+plen]=temp_string[i++];
         plen++;
 }
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</font></h1> ") );

/*... Begins here: "Move sensorValue to temp_string". 追加するd by sheepdogsoftware.co.uk

 It isn't as bad as it looks, though I'm sure this can be Done Better.
 If you don't like it, re-令状 it, and send me the Proper 職業.
 The 複雑さ arises from the need to pass the
 integer in sensorValue to ES_fill_tcp_data_p in a particular way.*/

   //Assumes sensorValue <2000
   i=0;
   if (sensorValue>999)
     {temp_string[i]='1';
     i++;
     sensorValue=sensorValue-1000;
     };

   i2=0;
   while (sensorValue>100)
    {i2++;
     sensorValue=sensorValue-100;
    };
   temp_string[i]=48+i2;
   i++;

   i2=0;
   while (sensorValue>10)
    {i2++;
     sensorValue=sensorValue-10;
    };
   temp_string[i]=48+i2;
   i++;

   i2=0;
   while (sensorValue>1)
    {i2++;
     sensorValue=sensorValue-1;
    };
   temp_string[i]=48+i2;
   i++;

   temp_string[i]=0;//示す end of string

//end of "Move sensorValue to temp_string"

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h2>Light Level: </h2>"));
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h1><font color=\"#0000FF\">"));

   i=0;
   while (temp_string[i]) {
    buf[TCP_CHECKSUM_L_P+3+plen]=temp_string[i++];
    plen++;
    }

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</font></h1>") );

//Buttons ... First button...
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=hidden 指名する=cmd value=2>"));
//             See tutorial. "cmd" is just a 指名する we elected to use. "指名する" is
//                   built into HTML, defined by it... but we could have
//                   used anything where we used "cmd"... as long as the code
//                   we've written どこかよそで in this same program is written
//                   to look for what we've used.

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=服従させる/提出する value=\"LED On\">"));
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</form>"));

//Second button...
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<form METHOD=get 活動/戦闘=\""));
plen=es.ES_fill_tcp_data(buf,plen,baseurl);
plen=es.ES_fill_tcp_data(buf,plen,":");  //Begin specification of port, in 事例/患者 not...
plen=es.ES_fill_tcp_data(buf,plen,portasstring);  // ...default port 80. Second of two instances
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("\">"));

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=hidden 指名する=cmd value=1>"));
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=服従させる/提出する value=\"LED Off\">"));
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</form>"));
//End of buttons HTLM

plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</中心>"));

return(plen);
}//end of "print_webpage"


/*==========================
Below here: For inputs/生産(高)s 拡張 of デモ,
新規加入s by sheepdogsoftware.co.uk */

無効の LEDOnOff(byte bOnOff){
//if 0 passed: Turn LED off, if <>0 then on.

++iClicks;//追加する 1 to the 一致する of clicks 過程d.

digitalWrite(beepPin,HIGH);//Make a 簡潔な/要約する beep as each request from (弁護士の)依頼人 is serviced
延期する(15);//Keep this short... say <30 (ms). The shorter the better,
//  really. But if too short, you won't hear any "beep"
digitalWrite(beepPin,LOW);

if (bOnOff==0)
{digitalWrite(ledPin,LOW);}
else
{digitalWrite(ledPin,HIGH);};
}//end of "LEDOnOff()"



I hope that was useful...

Remember: The code is explained for you at my page explaining the ArduSimpSrv 創造.




Search for other things...


Please 公式文書,認める that I have two other 場所/位置s, and that the に引き続いて search will not 含む them. They have their own search buttons.

My Sheepdog Guides 場所/位置.
My Arunet 場所/位置.

   Search this 場所/位置 or the web        力/強力にするd by FreeFind
 
  場所/位置 search Web search
場所/位置 地図/計画する    What's New    Search
The search engine 単に looks for the words you type, so....
*    (一定の)期間 them 適切に.
*    Don't bother with "How do I get rich?" That will 単に return pages with "how", "do", "I"....

You can also search this 場所/位置 without using forms.
広告 from page's editor: Yes.. I do enjoy 収集するing these things for you... hope they are helpful. However.. this doesn't 支払う/賃金 my 法案s!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and 循環させる it for me? Links on your page to this page would also be 高く評価する/(相場などが)上がるd!
Click here to visit editor's freeware, shareware page.


Want a 場所/位置 hosted, or email? You can also help me if you 調印する up 経由で this link to 1&1's services. (I wouldn't recommend them unless I was happy after several years as one of their 顧客s, but yes, they do 支払う/賃金 me if you use this link! As do the Google advertisers, about whom I know nothing, of course.)



Valid HTML 4.01 Transitional Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org

CSS behind the page checked, at least once upon a time!, with http://jigsaw.w3.org/css-validator/
Why does this page 原因(となる) a script to run? Because of the Google パネル盤s, and the code for the search button. Also, I have some of my pages' traffic 監視するd for me by eXTReMe tracker. They 申し込む/申し出 a 解放する/自由な tracker. If you want to try one, check out their 場所/位置. Why do I について言及する the script? Be sure you know all you need to about spyware.


Editor's Main Homepage
How to email or 令状 this page's editor, Tom Boyd

....... P a g e . . . E n d s .....