Skip to content

Conversation

sandeepmistry
Copy link
Owner

Fixes #24.

Can be tested via npm install sandeepmistry/chip-io#pwm-fixes.

if (value === 0) {
this.pinMode('PWM0', 1);
this.digitalWrite('PWM0', 0);
} else if (value === 255) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

255 works as expected in pwm mode.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmaxxz so should the entire } else if (value === 255) { be removed?

If this looks fine in your testing, I can make the change and update the PR.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delays, had the chip with my project on it break. Be a bit more responsive once get the spare spun up.

But yes, 255 works fine without switching to digital mode.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't led.on() call analog write with a value of 255?

I think Arduino code also has special checks like this so that 0 maps to LOW and 255 maps to HIGH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PWM0 does not support on state
2 participants