Not whole website sent (wemos d1r2)

I am working on a project where i would like to control a rgb led matrix over a webpage.
The webpage is hosted on a access point which is on a wemos d1r2.

However sometimes not all of the website is sent (or recieved?). Is there any way to control wheter the transfer was succesful and if not send it again? Or is there another problem?
Also when reloading the page it often shows the whole site so it is not a consistent problem.
Another question: Sometimes my smart phone will say after submitting the form in the code that the webpage is not responding even though that i send back the index page after the submit (look code below). Is there a timing problem or something else?

To the code: basically each point on the matrix will represent a geographical location (therefore the names) which people should then be able to turn on via the website. Also there will be groups (for example rivers).
I had to delete the htmlpage variable because otherwise the post is too long for the forum. But basically there are 64 checkboxes in a html form and a submit button.


#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>

int nLED = 64;
int maxLED = 20;
int LedBrightness = 50;
#define pinMatrix D6
byte group1[] = {17,18,19,20,21,22,25,33,34,35,36};
byte group2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
byte group3[] = {63,62,61,60,59,58};
byte group4[] = {1,2,3};
byte group5[] = {1,2,3};
byte group6[] = {1,2,3};
const char *ssid = "XaverNetwork";
const char *password = "98765432";
Adafruit_NeoPixel strip = Adafruit_NeoPixel(nLED, pinMatrix, NEO_GRB + NEO_KHZ800);
uint32_t colorNormal = strip.Color(255,255,255);
uint32_t colorGroup1 = strip.Color(255,0,0);
uint32_t colorGroup2 = strip.Color(0,255,0);
uint32_t colorGroup3 = strip.Color(0,0,255);
uint32_t colorGroup4 = strip.Color(255,255,255);
uint32_t colorGroup5 = strip.Color(255,255,255);
uint32_t colorGroup6 = strip.Color(255,255,255);
ESP8266WebServer server(80); //start the server
const char htmlpage[] = "I had to delete this part"
const char tooManyLed[] = "<h1> Please do not turn on more than 30 LED at once</h1>"
"<p> thanks for the understanding</p><form><input type='submit' value='continue'></form>";

void handleIndex() { //what will happen if User gets on the Index page
 server.send(200, "text/html", htmlpage);
void handleSubmit(){ //what happens when user presses submit on any form
  if(nArgs()>maxLED){server.send(200, "text/html", tooManyLed);} else{
  for(uint8_t i=0; i<nLED ;i++){strip.setPixelColor(i, strip.Color(0,0,0));} //on submit first turn off all LED
    for ( uint8_t i = 0; i < nLED ; i++ ) {
      if (server.hasArg(String(i))) { //only the turned on LED will be available in GET
    checkGroup1(); //turns on all LED defined in group array
   server.send(200, "text/html", htmlpage); //send back the original page, here is a problem

void setup() {
 delay(1000); //delay for everything to get ready
  strip.begin();; // Initialize all pixels to 'off'
  strip.setBrightness(LedBrightness); //adjust Value for Brightness (full is not recommended until external power supply is used)
 Serial.print("Configuring access point...");
 /* You can remove the password parameter if you want the AP to be open. */
 WiFi.softAP(ssid, password); //start access point

 IPAddress myIP = WiFi.softAPIP(); //save own ip adress
 Serial.print("AP IP address: ");
 server.on("/", handleIndex); //set server listener
  server.on("/submit", handleSubmit);//submit listener
 Serial.println("HTTP server started");

void loop() {

void checkGroup1(){
      for(uint8_t i =0;i<sizeof(group1);i++){
void checkGroup2(){ 
      for(uint8_t i =0;i<sizeof(group2);i++){
void checkGroup3(){ 
      for(uint8_t i =0;i<sizeof(group3);i++){
void checkGroup4(){ 
      for(uint8_t i =0;i<sizeof(group4);i++){
void checkGroup5(){ 
      for(uint8_t i =0;i<sizeof(group5);i++){
void checkGroup6(){ 
      for(uint8_t i =0;i<sizeof(group6);i++){
int nArgs(){
  int nArgs =0;
  nArgs = server.args();
  return nArgs;

Thanks alot for the help i really appreciate it!


I had to delete the htmlpage variable because otherwise the post is too long for the forum.

No. You could have used the Additional Options link to attach the code.

void checkGroup1(){
      for(uint8_t i =0;i<sizeof(group1);i++){

Why do you need to call show() after setting each pixel? Normally, that is done after setting all the pixels.

Sorry i didn’t see this option.
You are right thanks for pointing that out. Ill upload the code here in this comment then.

CodeForForum.ino (8.84 KB)

"<form action='' method='GET'>"

An action does not involve a protocol.

Unless you want to execute a script on a different server, it does not involve an IP address or server name, either.

  if(nArgs()>maxLED){server.send(200, "text/html", tooManyLed);} else{

ONE statement per line. Spacesaregood.

    for ( uint8_t i = 0; i < nLED ; i++ ) {
      if (server.hasArg(String(i))) {

You don’t have an object named ‘0’, so why are you testing for one? You do have one called ‘64’. Why are you not testing for it?

However sometimes not all of the website is sent (or recieved?).

That is a pretty large page - almost 5000 characters.

Ok i see i got some errors in there, the action part i copied from a website and thought i shouldnt change it. So baisically i can just put this line?

"<form action='/submit' method='GET'>"

And i see now that i made an error by starting with 1 instead of 0, thanks for noticing.

I would like to apologize for the messy code, i’m still a noobie when it comes to coding.

So it does fail because the file is too large? Because i already had twice the text at one point and it still worked almost as many times as it does now.

Thanks for the help!

So baisically i can just put this line?


So it does fail because the file is too large?

I can't see any other reason.

Alright I'll try to make it smaller then, but there is no way of checking on the wemos wheter the whole site was sent?

Thanks alot for the help!