I am currently using NodeMCU for my project and I have used up all my Digital pins and I need to turn on my buzzer if a certain condition is met. How do I use the A0 pin of my NodeMCU to trigger the buzzer? Any help would be much appreciated.
The numeric value of A0 is 17, as defined here. But unlike on an Arduino board, you can't use it as a digital pin. It only work for pin numbers 0-16. If you are using as a parameter for analogRead , the numeric values would be 0 and 17, as seen here.
Trying to establish what sort of device you have.
A BEEPER that makes its own sound, or a speaker type unit that needs a changing current to make a noise.
yes, i have tested them. But my issue is that all my digital pins are occupied and I'm only left with A0 pin, hence i asked "how do i use the A0 pin to trigger the buzzer".
But it's okay, I'll try to use a shift register as suggested by the other user.
It was suggested that you could use the analog input as a psuedo digitsl input.
If you have a NodeMCU that has the voltage divider on the analog input.
Detect a HIGH with: if(analogRead(pin) > 620); // more than 2V
and a LOW with if(analogRead(pin) < 310); // less than 1V