'switchhandler' reserved keyword?

I set up a very basic start of a new project: LED on pin 9, switch on pin1.
The callback function for the switch input I named ‘switchhandler’, simply changing the duty cycle of the PWM output controlling the LED.
However extremely simple this setup was, it didn’t work :"> In a brief moment of sanity (rest assured: they are rare) I changed the function name to ‘swhandler’ and it worked :wink:
So my question: is ‘switchhandler’ a reserved keyword?

btw I did not get any error message returned in the code that used ‘switchhandler’

cheers, Moose

It is not - and I just tried using switch handler for a variety of things, and it worked fine.

I’m guessing you had a spelling / typing mistake somewhere?

`server.log(“running”)

function switchhandler() {
server.log(“changed”);
}

hardware.pin9.configure(DIGITAL_IN_PULLUP, switchhandler);`

Just renamed the switch handler back to ‘switchhandler’ and it also worked fine :">
I do not understand what went wrong the first time…

You also will not have an error returned if you type

Server.log(“hello”);

instead of

server.log(“hello”);

but at runtime this will raise an error.

The code checking does not perfectly check all things.

Code checking is just compiling - it doesn’t catch runtime errors…