Just wanted to post a message about some funkiness I noticed with analogWrites on the MDBT42Q - there's a pretty solid chance I'm just misunderstanding some of the docs so apologies in advance if thats the case!
Doing an analogWrite with just the pin & value (between 0 & 1) works fine, albeit with some flickering when trying to update the value every 100ms but likely because its software PWM, so that comes with the territory.
The weirdness I noticed was with some of the options:
If I've already set the pinMode to "output", passing an options object to analogWrite ignores the value and sets the pin to 100% on, regardless of whats in it
If I've not already set the pinMode, passing an empty options object, or an options object containing forceSoft: false or soft: true/false to analogWrite ignores the value and sets the pin to 100% on.
If I've not already set the pinMode, passing an options object just containing forceSoft: true to analogWrite allows me to set the value to either 0 or 1, any number in between is interpreted as a 0
I'm 50/50 on if I've just badly misinterpreted what the options object is for, but I wanted to ask just in case this isn't expected behavior :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hey there!
Just wanted to post a message about some funkiness I noticed with analogWrites on the MDBT42Q - there's a pretty solid chance I'm just misunderstanding some of the docs so apologies in advance if thats the case!
Doing an analogWrite with just the pin & value (between 0 & 1) works fine, albeit with some flickering when trying to update the value every 100ms but likely because its software PWM, so that comes with the territory.
The weirdness I noticed was with some of the options:
If I've already set the pinMode to "output", passing an options object to analogWrite ignores the value and sets the pin to 100% on, regardless of whats in it
If I've not already set the pinMode, passing an empty options object, or an options object containing forceSoft: false or soft: true/false to analogWrite ignores the value and sets the pin to 100% on.
If I've not already set the pinMode, passing an options object just containing forceSoft: true to analogWrite allows me to set the value to either 0 or 1, any number in between is interpreted as a 0
I'm 50/50 on if I've just badly misinterpreted what the options object is for, but I wanted to ask just in case this isn't expected behavior :)