-
Notifications
You must be signed in to change notification settings - Fork 50
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
TouchButton::setPinValue(1)
results in a pin voltage lower than Vin
#346
Comments
TouchSensor::setPinValue()
on a pin results in a voltage lower than VinTouchSensor::setPinValue(1)
results in a pin voltage lower than Vin
TouchSensor::setPinValue(1)
results in a pin voltage lower than VinTouchButton::setPinValue(1)
results in a pin voltage lower than Vin
S'cuse the bad photo, but having tested this on P2 (for ease of connection to the scope), I see this waveform when touch mode is enabled and The PWMing effect of this would account for the lower voltage you're seeing, I guess @microbit-carlos Edit I just noticed that the average the scope reports is 2.27v, which is right where you see it... |
Yeah, that would explain the voltage value. Btw, how is capacitance touch done on the digital pins with CODAL? Isn't setting the pin high and then measuring how long it takes to go low? Do you get the same waveform when |
Now fixed according to my VW Passat GTE scope, as per #345 |
But Joe, we were testing pins not the g-force events! 🤣 I've given this a quick test with the latest commits in all codal repos:
018864d And with a simple test programme like this, I'm still seeing ~2.2-2.6V in pin16 and the face logo with a multimeter: #include "MicroBit.h"
MicroBit uBit;
int main() {
uBit.init();
TouchButton *pin16Touch = new TouchButton(uBit.io.P16, uBit.touchSensor, CAPTOUCH_DEFAULT_CALIBRATION);
pin16Touch->setPinValue(1);
uBit.logo.setPinValue(1);
while (true) {
uBit.sleep(1000);
}
} |
Okay, with this other test I can confirm that using With this programme:
#include "MicroBit.h"
MicroBit uBit;
int main() {
uBit.init();
TouchButton *pin16Touch = new TouchButton(uBit.io.P16, uBit.touchSensor, CAPTOUCH_DEFAULT_CALIBRATION);
pin16Touch->setPinValue(1);
uBit.logo.setPinValue(1);
while (true) {
if (uBit.buttonA.isPressed()) {
uBit.io.logo.setDigitalValue(1);
uBit.io.P16.setDigitalValue(1);
uBit.display.print("A");
}
uBit.sleep(200);
}
} |
Ah, that'll likely be because void TouchButton::setPinValue(int v)
{
setPinLock(true);
_pin.setDigitalValue(v);
setPinLock(false);
} |
To replicate on USB power:
MICROBIT.hex.zip
The text was updated successfully, but these errors were encountered: