Can I call analogwrite to TX/RX from CLI?

Is it possible to make a call to analogwrite on the TX or RX pins from the command line interface? For instance (which returns -1 and doesn’t work):

particle call photonXYZ analogwrite TX=50

I can’t seem to find anything in the documentation or community forums.

Thanks for any help!

If you look at the Photon datasheet you’ll see these are PWM enabled, so yes.

Also the docs for analogWrite() (PWM) clearly state

Hey ScruffR,

Thanks for getting back to me!

You are right, it does clearly state that RX and TX pins can be used for PWM. However, when I make the following statement in the particle CLI, I am returned with a -1.

particle call MyPhoton analogwrite TX=50

I am obviously missing something, but I don’t know what! Am I supposed to make the call using something else to identify the TX pin. For instance the DAC and WKP pins can be called using A6 and A7, respectively, correct? I thought using A8 and A9 for TX and RX might work, but did not seem to.

Thanks again!

@Skycocker, I can only assume your Photon is running Tinker, which explains why you are trying to send that command to it. Tinker is not “built-in” to a Photon. It is simply an application like any other. In fact, the code is available as a library on the Web IDE!

All this to say that Tinker does not support any commands relating to the TX and RX pins. You could take the source code, modify it to add those pins for control and boom, you have what you need!


Yes, I should have been clearer with my question that my photon was running Tinker! It’s a great tool for isolating hardware issues, unless I don’t what I’m doing!

Thank you for your help!

1 Like