Replicable in CODAL v0.2.66, also adding an extra isTouched() call in case it's needed:
#include "MicroBit.h"
MicroBit uBit;
int main() {
uBit.init();
while (true) {
uBit.io.P0.isTouched(TouchMode::Capacitative);
uBit.sleep(1);
if (uBit.io.P0.isTouched(TouchMode::Capacitative)) {
uBit.display.print('C');
} else {
uBit.display.clear();
}
uBit.sleep(300);
uBit.io.P0.isTouched(TouchMode::Resistive);
uBit.sleep(1);
if (uBit.io.P0.isTouched(TouchMode::Resistive)) {
uBit.display.print('R');
} else {
uBit.display.clear();
}
uBit.sleep(300);
}
}
Related to this issue, but not quite the same. That issue is about only the uBit.logo (TouchButton) not working after setting the type to resistive, this is about none of the NRF52Pin touch pins working when switching modes quickly.
Easier to visualise in MakeCode:
Replicable in CODAL v0.2.66, also adding an extra
isTouched()
call in case it's needed:Related to this issue, but not quite the same. That issue is about only the
uBit.logo
(TouchButton) not working after setting the type to resistive, this is about none of the NRF52Pin touch pins working when switching modes quickly.