-
Notifications
You must be signed in to change notification settings - Fork 481
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
MicroBit Capacitive Touch #35864
MicroBit Capacitive Touch #35864
Conversation
super(); | ||
this.board = board; | ||
|
||
// Flag to only trigger event on first of type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify this comment?
this.board = board; | ||
|
||
// Flag to only trigger event on first of type | ||
this.connect = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read connect
as a verb. Would isConnected
or hasConnected
make sense here?
} | ||
|
||
start() { | ||
this.board.mb.streamAnalogChannel(this.board.pin); // enable temp sensor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temp? Should be captouch? (and below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh good catch - thanks!
this.readSensorTimer = setInterval(() => { | ||
let currentValue = this.board.mb.analogChannel[this.board.pin]; | ||
if (this.board.mb.analogChannel[this.board.pin] !== 255) { | ||
if (currentValue > this.releaseReading + 200 && !this.connect) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why + 200 here and + 100 below?
if (this.board.mb.analogChannel[this.board.pin] !== 255) { | ||
if ( | ||
currentValue > this.releaseReading + this.connectedDelta && | ||
!this.connect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should now be connected
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one comment, but other than that looks great!
Implements the Capacitive Touch functionality for the MicroBit. See API spec: https://docs.google.com/document/d/1oPqJpIsaaGIQv7_KvCShmw6i0mT6MP3VqBP41yZ5M5c/edit#heading=h.ak61axyp722j
Includes tests.
Includes droplet blocks in
Maker
toolbox.Should only exist behind microbit experiment flag and droplet blocks only appear when using MicroBit and not CP.
Links
Testing story
Reviewer Checklist: