HTML Arduino Person Counter

Hello, we are trying to show the value of our two Ultrasonic arduino captors on a HTLM Web page. The first part of the code is working and the values are displayed in the serial monitor. We’ve partially managed to mix it with an HTML request but we do not understand how to adapt the final part of the code from the EthernetClient line. The purpose is to display the “visitor” variable on our html page which is on our SD card.

Can someone please help us ? :slight_smile:

Here is the html page’s code, and we’ve joined the arduino code.

TSTIDD

Compteur de personne

Le nombre de personne est de
XFF

Actualiser

cliquer pour actualiseriçi

test1.ino (7.02 KB)

I would strongly advice agains sending the entire web-page from the Arduino each time the counters are updated. I would recommend you to use the Arduino to serve the counters as a JSON-object which can be polled with JavaScript / AJAX and updated without reloading the entire page every time.

But… I think your problem is that in HTML, the place where to put the counter is where “XFF” is found. XFF is ASCII text worth 3 characters. “file.read()” returns one byte / character which you test for being “0xFF” - this cannot work.

Try to replace "XFF " with “$” in the HTML and “if ((c==0xff)&&(flghtm==1))” with “if ((c==’$’)&&(flghtm==1))” in the sketch and see what happens :slight_smile: