Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encourage to use sensor.scaleTo instead Fn.map #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ccarruitero
Copy link
Contributor

I think will better encourage to use the api proposed by johnny-five (sensor.scaleTo) instead an internal function like Fn.map.

I removed the scale comment since is deprecated


// `this.value` will reflect a scaling from 0-1023 to 0-179
servo.to(this.value)
servo.to(pot.scaleTo(0, 179))
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need to use this.value here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, isn't necessary.

In this solution this.value doesn't have the scaled value.

If we want to use this.value, like in the scale comment, I think we have to chain the scaleTo with the on change: pot.scaleTo(0, 179).on('change', ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ping @alanshaw

@ccarruitero
Copy link
Contributor Author

@alanshaw I just updated the PR to use this.value. Take a look when you have a chance.

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.

2 participants