LED Matrix Question

Ok so I don’t have a lot of programming experience, I only just starting learning Java in school. I built this program using a few examples off the internet. I’m using an Arduino Ethernet and 4 led matrices to scroll text across them.

Basically what I’m trying to do is control this led matix over the internet by either pushing a button to display a set text value, which I have figured out and is working, or letting the user enter in a custom text value into the box and having it display that but that is where I’m running into problems I can’t exactly figure that out.

I attached my code because it’s too much to post…

MAX7219_5_with_Ethernet.zip (3.36 KB)

This appears to be where it’s going wrong

      String t = "";
           if (readString.indexOf("demo_form_action.asp?user="+t) >0){
             
             printStringWithShift(t, 100);

So you’re setting a variable t to be an empty string, and if the user is sending a custom string, you then print the variable that you just made an empty string!

Don’t worry it happens to all of us :slight_smile:

Ok I see what you mean there, but I don't exactly understand how to parse the url that they send into being something that prints it out in that code there.

Try to replace this

           String t = "";
           if (readString.indexOf("demo_form_action.asp?user="+t) >0){
             
             printStringWithShift(t, 100); 
             
           }

With this

 char t[100] = {""};
           if (readString.indexOf("demo_form_action.asp?user=") >0){
             int strPos=readString.indexOf("user=")+5;
             readString.substring(strPos).toCharArray(t,100);
             printStringWithShift(t, 100); 
             
           }

Ok that worked.

I do have a quick question though regarding formatting. All the spaces appear as pluses as they do in the url bar.

It also prints "HTTP/1.1" at the end of every statement.

It would also not scroll completely off of the display at the end so I added the last line of code to deal with that. -string6 is just a bunch of spaces.

char t[100] = {""};
           if (readString.indexOf("demo_form_action.asp?user=") >0){
             int strPos=readString.indexOf("user=")+5;
             readString.substring(strPos).toCharArray(t,100);
             printStringWithShift(t, 100); 
             printStringWithShift(string6, 100);
           }

wcjones:
Ok that worked.

I do have a quick question though regarding formatting. All the spaces appear as pluses as they do in the url bar.

It also prints "HTTP/1.1" at the end of every statement.

It would also not scroll completely off of the display at the end so I added the last line of code to deal with that. -string6 is just a bunch of spaces.

char t[100] = {""};

if (readString.indexOf("demo_form_action.asp?user=") >0){
            int strPos=readString.indexOf("user=")+5;
            readString.substring(strPos).toCharArray(t,100);
            printStringWithShift(t, 100);
            printStringWithShift(string6, 100);
          }

Sorry, I think I'd need to recreate that to see what you mean. Unfortunately I don't have an Ethernet shield and, at the moment, I don't even have a working arduino at my disposal.

Actually I guess since I’m sending this as an http request all symbols are going to be encoded weird like that.

And yeah that’s fine I’m just trying to learn a little bit more about it no worries, that first part was the big thing I was trying to figure out.