Possible to increase the PWM resolution?

is it possible to increase the PWM resolution from 8 bit to 10 bit or possible 12 bit, with xod?

XOD appears to have no built-in node for this.

Only some boards support analogWriteResolution(): SAMD (Zero, Adafruit M0 and M4’s), Adafruit nrf52’s, etc. This is poorly documented. Possibly the easiest way to check is to write a regular Arduino sketch, very simple:

void setup() { analogWriteResolution(10); }
void loop() { delay(10); }

And simply “compile” it with the correct board selected.

If it is not supported, you get:
error: 'analogWriteResolution' was not declared in this scope

I wrote an untested node to implement analogWriteResolution(). “Untested”, you say? Yes, I’ve forgotten how to convince XOD to add boards, and I only have Adafruit SAMD boards. Will try to actually test soon.

  • only works on SAMD’s
  • generates an ERROR on non-SAMD
  • should be reviewed (code, documentation, etc)

Here is the xodball with the analog-write-resolution patch.

If anyone can test/improve before I get to it, please do!
analog-write-resolution

analog-write-resolution.xodball (1.9 KB)

(@mitch-bogart asked about this in 2020)