Arduino ethershield webserver control 7 segment (3 digit)

I need to control 7 segment (3 digit) on webpage by textbox . :~
my condition
if i need to show “999” on 7 segment, I will insert “999” in textbox then i click button to send “999” to 7 segment and show current 7 segment number on webpage also.

now, I can set “999” to show no 7 segment by fix code but i can’t create textbox an send “999” to 7 segment as my condition because i don’t know how to ?
somebody can you help me, please
sorry about my English is not well (so bad) XD

This is some mycode

    #include "etherShield.h"
    static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};
    static uint8_t myip[4] = {192,168,1,15};
    static char baseurl[]="";
    static uint16_t mywwwport =80; // listen port for tcp/www (max range 1-254)

    #define BUFFER_SIZE 500
    static uint8_t buf[BUFFER_SIZE+1];
    #define STR_BUFFER_SIZE 22
    static char strbuf[STR_BUFFER_SIZE+1];
    EtherShield es=EtherShield();
    uint16_t print_webpage(uint8_t *buf, byte on_off);
    uint16_t display_digit(uint16_t ds1);
    int8_t analyse_cmd(char *str);
  //  Use 3 74HC595 shift registers to display 3 numbers 
    int LatchPin = 5;
    int ClockPin = 6;
    int DataPin = 7;
    char m[4];
    byte data;
    byte dataArray[10];

    void setup(){
      pinMode(LatchPin, OUTPUT);
      pinMode(ClockPin, OUTPUT);
      pinMode(DataPin, OUTPUT);
          /*initialize enc28j60*/
       es.ES_enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz

    void loop(){
      uint16_t plen, dat_p;
      int8_t cmd;
      byte on_off = 1;
      int8_t Actual=0;

         plen = es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf);

        // 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
          if (buf[TCP_FLAGS_P] & TCP_FLAGS_ACK_V){
            es.ES_init_len_info(buf); // init some data structures
            if (dat_p==0){ // we can possibly have no data, just ack:
              if (buf[TCP_FLAGS_P] & TCP_FLAGS_FIN_V){
            if (strncmp("GET ",(char *)&(buf[dat_p]),4)!=0){
                      // head, post and other methods for possible status codes see:
                plen=es.ES_fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1>200 OK</h1>"));
                goto SENDTCP;
            if (strncmp("/ ",(char *)&(buf[dat_p+4]),2)==0){
                    plen=print_webpage(buf, on_off);
                goto SENDTCP;
            cmd=analyse_cmd((char *)&(buf[dat_p+5]));
            if (cmd==2){
            else if (cmd==3){
                      plen=print_webpage(buf, on_off);
                       plen=print_webpage(buf, on_off);
    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      
    ///------------------- 7 segment function-------------------------//
    uint16_t display_digit(uint16_t ds1)
      uint16_t digit[3],i,loop_digit,dis;
   char num_led[17] = {0x3F,0x06,0x5B,0x4F,0x66,

      digit[0] = num_led[ds1%10];
      digit[1] = num_led[(ds1/10)%10];
      digit[2] = num_led[(ds1/100)%10];

      digitalWrite(ClockPin, LOW);
       digitalWrite(LatchPin, HIGH);

         dis = digit[loop_digit];
               digitalWrite(DataPin, LOW);
          digitalWrite(DataPin, HIGH);
               digitalWrite(ClockPin, HIGH);
               digitalWrite(ClockPin, LOW);
       digitalWrite(LatchPin, LOW);
       digitalWrite(LatchPin, HIGH);


    ///---------------------End of 7 segment function-----------------------//

    uint8_t find_key_val(char *str,char *key)
            uint8_t found=0;
            uint8_t i=0;
            char *kp;
            while(*str &&  *str!=' ' && found==0){
                    if (*str == *kp){
                            if (*kp == '\0'){
                                    if (*str == '='){
            if (found==1){
                         while(*str &&  *str!=' ' && *str!='&' && i<STR_BUFFER_SIZE){

    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
            return r;
    ///--------------------- Webpage -----------------------//

    uint16_t print_webpage(uint8_t *buf, byte on_off)
           int i=0;
            uint16_t plen;
            plen=es.ES_fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"));
            plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<center><p><h1>Counter Boards Monitoring</h1></p> "));
<form METHOD=get action=\""));
            plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h2> Counter board is </h2> "));
            plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h1><font color=\"#00FF00\"> "));
            plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("  </font></h1>
 ") );
                    plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=hidden name=cmd value=3>"));
                    plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=\"Set Target\"></form>"));
            else {
                    plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=hidden name=cmd value=2>"));
                    plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=\"Actual\"></form>"));
            plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</center><hr> <p>Counter boards monitoring V.1  <a href=\"\"><a>"));

A seven segment display can display ONE digit. Unless that is not exactly what you have. If it isn't, you need to clearly describe what it is you have.

Global variables do not need to be static.


i need variables value of 7 segment between 000-999 as number in textbox to show on 7 segment but i don't know to made! =(

i need variables value of 7 segment, 000-999 show on 7 segment but i don't know to made!

I don't understand this. You need help splitting a number into three digits? You need help making one of those digits appear?

no, now i can set 7 segment by this code


but my problem : i don't know how to set number through textbox on webpage.(control by textbox)

Someboday can you help me, please

your html page must be configured to do http post when send button is clicked.
you then need to handle POST request on the webserver code in Arduino.
Most examples floating around are just cover simplistic GET handler.
It is not that hard to handle POST requests. I’m sure you can find plenty of code examples by doing a search.

Hello again!

I change my code for Arduino v1.0 as you see, it’s work by manual (I must enter number at last url ). example “”
but i need to enter number into texbox.
sombody can you help me!!!

void loop()

if (params = server.serviceRequest())


7 Segment Monitoring

server.print(“Target: “);
server.print(”<input type=submit name=submit value=SET 7SEG>
//server.print(”<a href=’> <input type=submit name=getit1 value=SET 7SEG>”);

server.print(“7 segment status is :”);
uint16_t a=atoi(params);
//int16_t a=1100