Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add LED.set() function #70

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

Closed
Ivoah wants to merge 2 commits into micropython:master from Ivoah:patch-1
Closed

Add LED.set() function #70

Ivoah wants to merge 2 commits into micropython:master from Ivoah:patch-1

Conversation

@Ivoah
Copy link

@Ivoah Ivoah commented Mar 7, 2016

No description provided.

pyb/pyb.py Outdated
self.f.write(b"0")

def set(self, v):
self.f.write(b"{}".format(0 if v < 0 else 255 if v > 255 else v))
Copy link
Contributor

@SpotlightKid SpotlightKid Apr 16, 2016

Choose a reason for hiding this comment

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

I find this much clearer to read:

self.f.write(b"{}".format(max(0, min(255, v)))

Ivoah reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe, but it involves 2 function calls. And the original is almost plain English anyway ;-).

Copy link
Author

Choose a reason for hiding this comment

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

Should I revert it to what I had before?

Copy link
Contributor

pfalcon commented Apr 18, 2016

@Ivoah : Sorry, I'm losing track of things ;-). I thought @SpotlightKid's comment was about a file already in a master, not about a pull request.

The problem with this patch is that this module is intended to emulate pyboard's "pyb" module. And pyb.LED class of pyboard doesn't have .set() method.

Copy link
Author

Ivoah commented Apr 18, 2016

Well, I could always make a pull request to the main pyb module too ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /