Thank you very much for your answer, however it is not clear how it works. I’ll give you an example:
Your Arduino IDE works like this (with R=1.5k of PullDown):
// constants won't change. They're used here to set pin numbers:
const int buttonPin = D3; // the number of the pushbutton pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
Serial.println(1);
} else {
Serial.println(0);
}
delay(50);
}
I expect it will also work on OpenMV with this sketch:
import time
from pyb import Pin
# Creates a Pin object associated with pin D3
p3 = Pin("D3", Pin.IN, None)
while True:
#Read
button_state = p3.value()
# Print lable
if button_state == 0:
print("0")
else:
print("1")
time.sleep(0.1) #delay
however I don’t have the same result, where am I going wrong? also consider that the circuit configuration is the same.