Unable to call a particle function

Hi, I am new to the particle firmware and I’m working with the various functions available. I was testing the Particle.function() and made a simple function to be called through the console. However, whenever I call it I get an error message saying unable to call the function.

Could you show us your code?

@moz just to add to @Moors7 request. It really helps us responding if you can state the Device OS version and the code you are using. There are many examples in the reference documents of how to declare a Particle function and the function you need to define to handle the function call. Please have a look and see if there is anything there which explains why you are getting an error. It sounds like you are not declaring it correctly or not returning an integer.

1 Like

Hi. I found the error I was doing. Apparently, there can’t be spaces in the field name which is to be displayed in the console.

Particle.function(“Check status”, chkanlg); //This didn’t work
Particle.function"Check_status", chkanlg); //This worked

Thank you for your support.

Not only apparently, it’s also documented
https://docs.particle.io/reference/device-os/firmware/xenon/#particle-function-

And that’s why your first response you got was

1 Like