MicroView analog pins

Hi everyone,

I’m new to the forum and somewhat to Arduino.

I got the Sparkfun MicroView from Kickstarter many years ago, I just pulled it out from my garage and decided to fire it up for a little project. I managed to make a stepper motor work and I’m thrilled.

Now I wanted to use 3 buttons to control the direction of the motor, but I only have 2 digital pins left.

So I connected the buttons to the analog ones, but for some reason I’m unable to make them work.

1- Can I use the analog pins of the MicroView like they were digital pins?

2- Meanwhile I’ve tried using both the digital and the analog pins to read a button status, but I don’t understand if I’m doing it correctly. At the moment when I press the button something happens, but in the console monitor I don’t see “yes”, just garbage characters…

const int buttonPin = A0;
int buttonState = 0;   
    
void setup() {
  Serial.begin(9600);
  
  // pinMode(buttonPin, INPUT);
}

void loop() {
  buttonState = digitalRead(buttonPin);
  
  if (buttonState == HIGH) {
    Serial.println("yes");
  } else {
    Serial.println("no");
  }
}

Serial console:

19:27:06.733 -> no
19:27:06.733 -> no
19:27:06.733 -> no
19:27:06.733 -> noH⸮⸮H⸮⸮H⸮⸮H⸮⸮H⸮⸮H⸮⸮H

What am I doing wrong?

I have connected the A0 pin to one side of the button, the other side is connected to the GND

Pins reference for the MicroView: https://learn.sparkfun.com/tutorials/mi … w-overview

If I’m not on the correct category feel free to move my thread,

thanks for your help

I can answer myself to the questions:

1- Yes

2- I managed to make it work by using the “ezButton” library

https://arduinogetstarted.com/faq/how-t … le-buttons

I’m still curious about how to do it without an external library…