Hello.
I am developing a web app with node.js.
I am having a problem calling function. When I call a function in the cloud, which just turns on led D7, in the cmd it is said that the fucntion was called properly, but the led does not turn on.
Here is my code with jade.js using express as framewrok:
I may be misunderstanding your environment, but when I call a function using the particle-api-js from node.js, I use a particle.callFunction which takes an object containing the device ID, function, arguments and authentication token and returns a promise. https://docs.particle.io/reference/javascript/#callfunction
I don’t think you can use it like that. The particle.callFunction() returns a Promise. The code actually starts the operation at the point you call particle.callFunction(), not when you execute the then(). The example is misleading because fnPr makes it seem like a C function pointer, but it doesn’t really work like that.
Instead of using the variable on, try moving the actual particle.callFunction() call where the then is.