Hi there
I have a imp001.
I have 2 Grove buttons on my device, both connected to the 2 i2c Grove ports, however it appears that when I press either button the same code (function buttonPress()) is executed. See code below:
button <- hardware.pin8;
function buttonPress() {
if (button.read() == 1) {
server.log("Button 1 pressed");
} else {
server.log("Button 1 released");
}
}
button.configure(DIGITAL_IN_PULLUP, buttonPress);
button2 <- hardware.pin9;
function buttonPress2() {
if (button2.read() == 1) {
server.log("Button 2 pressed");
} else {
server.log("Button 2 released");
}
}
button2.configure(DIGITAL_IN_PULLUP, buttonPress2);
Can anyone please tell me what I am doing wrong here?
Appreciate in advance.