analogdevicesinc / arduino-max326xx

Arduino core for Maxim's MAX326xx series boards
Other
0 stars 0 forks source link

digitalRead does not work #12

Closed idea--list closed 4 years ago

idea--list commented 4 years ago

Hi there, As an alternative to mbed-os, i wanted to try this Arduino core (with Arduino IDE v1.8.11) for the MAX32630FTHR.

This code works on an Arduino Uno, however on the MAX32630FTHR the state of the user button never changes: `void setup() { Serial.begin(9600); // initialize digital pin P2_3 (User button) as an input. pinMode(P2_3, INPUT); }

// the loop function runs over and over again forever void loop() { int myValue = digitalRead(P2_3); Serial.print("Button logic level = " ); Serial.println(myValue); delay(1000); // wait for a second }`

I am absolutely sure P2_3 is the name of the user button pin. I wonder what i might b doing wrong?

khariya commented 4 years ago

Please configure your button pin as: pinMode(P2_3, INPUT_PULLUP);

idea--list commented 4 years ago

That does the trick, thanks!