1 (edited by salsedine 2020-04-21 16:36:54)

Topic: [solved] Working mode: random/app

I'm working with a nodemcu v3 for a project to use at school during open events. My project is done with a RGB led, a Dallas temperature gauge, a DC engine (PWM)+photo resistor+laser beam [i read spins], 16x2 LCD.
So the led lights randomly, the engine runs randomly too and on the display it shows the temperature and rounds per minute. This happens when "NO CLIENT" is connected to the nodemcu,
While it someone is connected to nodemcu, it will being drived by the app.
So i don't know which syntax to use for my "if" cicle:

if (??????????????????????)

I tried:

  • WiFi.status() != WL_CONNECTED

  • !client.connected()

  • WiFi.waitForConnectResult() != WL_CONNECTED

  • WiFi.localIP().toString() == ""

Which is the compatible function to use with the RemoteXY library??? I tried calling the WiFi.begin() function too.


Re: [solved] Working mode: random/app

if (RemoteXY.connect_flag != 0) {
  // connection established
else {
  // connection off


Re: [solved] Working mode: random/app

I've just focused my attention on that flag, thanks.

Some debug:

1) when i connect, the flag goes 1 and i control the RGB led;

2)On the app i put 2 char boxes [5], one for the temperature (i read the value no problem) and the other to show RPM of the engine. This second box shows always a flashing "00" and when it starts to generate numbers (rounds of engine) suddenly the connect_flag goes to 0( i need to reenter in the app).

I used your guide to convert from int to char with sprintf, itoa doesn't work.  I see right values in my serial monitor, but not in the app (no RPM, yes temperature).

This is my code, hope it helps:

if (currentmillis - lastmillis <= interval){ 
 rpm = half_revolutions * ((60000/(currentmillis - lastmillis)));
 //Serial.print(" RPM");
 half_revolutions = 0;
 lastmillis = currentmillis;
 attachInterrupt(IR, rpm_fan, FALLING);
sprintf (RemoteXY.giri, "%d", rpm);

ICACHE_RAM_ATTR void rpm_fan(){


Re: [solved] Working mode: random/app

What the length of RemoteXY.giri ?


Re: [solved] Working mode: random/app

Five for both char variables.


Re: [solved] Working mode: random/app

I think but i could be wrong that the issue is related the way which your app handles interrupts. It isn't able to work with them,
only rounds of engine uses interrupts and so do not work.

7 (edited by Guillaume 2020-04-21 13:12:16)

Re: [solved] Working mode: random/app

Show FULL code

And what is the value of rpm whe the problem is happening ?

itoa works, I use it every days

8 (edited by salsedine 2020-04-21 16:36:34)

Re: [solved] Working mode: random/app

SOLVED!!! i've increased the size of the char from 4 to 7 and i get values!!!