B4R Question Use Analog Pins as Digital Pins?

ilan

Expert
Licensed User
Longtime User
Hi

i see that it is possible to use Analog Pins as Digital pins. so if i am out of all digital pins i could basically use the analog pins to write HIGH/LOW Voltage like i do with Digital Pins, right?


how to initialize the Pin? with A1 instead of 1 (like a digital pin)?
 

klaus

Expert
Licensed User
Longtime User
The initialization is the same.
Only the pin number is different.
Digital pin, pin number as integer:
B4X:
DPin.Initialize(3, DPin.MODE_INPUT)
Analog pin:
Analog pin, pin number like below:
B4X:
APin.Initialize(APin.A0, APin.MODE_INPUT)

A link to documentation.
 
Last edited:
Upvote 0
Top