Answer the question
In order to leave comments, you need to log in
STM32 how to make a leg an input?
I assembled the circuit on STM32, put 6 legs on the input. Digital.Write set to LOW but still it has 3.3 V, how to make it so that it would be able to read
Code:
int i=0;
void setup()
{
pinMode(PC13, OUTPUT); //LED on pin 13
pinMode(6, INPUT); //6 pin - in input mode. The button is connected to ground.
digitalWrite(6, LOW); //connect pull-up resistor
}
void loop()
{
digitalWrite(PC13, digitalRead(6)); // read the button state and toggle the LED
if(!digitalRead(6) ){
i++;
}
Serial.print(i);
delay(500);
}
Answer the question
In order to leave comments, you need to log in
3.3v and will be on this leg in the "input" mode because the pull-up resistor is inside, you can turn it off but you have to install an external resistor and the same situation will come out.
Well, in order to read the state of the leg, it is necessary to catch a low level on it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question