So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Jim Doe
#94865 I am working on a project using a NodeMCU ESP8266 and DFPlayer Mini MP3 Player.
I want to control the MP3 player from a cell phone with the ESP8266 using AP mode.
The software in the ESP8266 has a list of song titles stored as array data in PROGMEM
I would like to send the title of the song playing to a text box in the WEB page hosted by the NodeMCU esp8266.
I have searched and researched all over with no luck.
Plenty of examples on sending from the WEB page to the software but I need to go the other direction.
What method is use for this task?
User avatar
By davydnorris
#94879 Most common approach is to have a little bit of javascript on the page that either opens a websocket or polls an endpoint periodically.

Are you actually using NodeMCU with lua or are you using some other programming environment? There are projects out there that show you how to do this for NonOS, RTOS and Arduino
User avatar
By Jim Doe
#94880 I am using Arduino based development.
I found a sample project that gets close to what i need .
document.getElementById("outputState").innerHTML = outputStateM;
The problem with this is loading the (outputStateM) variable from an array of strings (song titles) that are created and stored outside the scope of the <script>.
Can Javascript access arrays stored globally in the C code section?
User avatar
By Jim Doe
#94881 I have found examples that are close to what I need but I have not found a method to output text strings created in the scope of the Arduino C code to the JavaScript.
I have tried to create the strings in the JavaScript without success. It will only allow a few strings in the JavaScript with out causing other compiler errors.

This seems to be the direction to go but...
document.getElementById("outputState").innerHTML = outputStateM;

I need to set (outputStateM) to the text string to display.

Strings are created like this:
const char string_0[] PROGMEM = "Make A Selection" ;
const char string_1[] PROGMEM = "Young Girl" ;
const char string_2[] PROGMEM = "Lady Willpower" ;
const char string_3[] PROGMEM = "Bad, Bad Leroy Brown" ;
const char string_4[] PROGMEM = "You Don't Mess Around With Jim" ;
const char string_5[] PROGMEM = "I Got A Name" ;
const char string_6[] PROGMEM = "I'll Have To Say I Love You In A Song" ;
const char string_7[] PROGMEM = "Operator" ;
const char string_8[] PROGMEM = "Time In A Bottle" ;
const char string_9[] PROGMEM = "It's a Long Way There" ;