Home automatin>LED_CONTROL>change of pin to A0 not working

In the Home Automation module concept of LED Control
I was able to do the part in the first go where we do the connection as described and connect with the pin “0” and could turn the LED ON or OFF.
In the next part where we write the code in JS, it is mentioned as we can use the following pins:
so i tried to do the connection to A0 pin i also changed it in my code:
singleButton({name:“Led On”, action:“digitalWrite”,
pin:“A0”, value:“HIGH”})

singleButton({name:“Led Off”, action:“digitalWrite”,
pin:“A0”, value:“LOW”})
but it’s not working
can someone explain why it’s not working and what changes do i need to make??

@kaustubhnov7 A0 is the ADC pin i.e. Analog to Digital Converter. It basically changes the analog value from input devices to digital values so that we can have numerical representation of the same. Rest of the 05 GPIO pins are basically used for operating the output devices (LED, Buzzer and so on).

In order to control the LED you can’t use the A0 pin, you have to use the GPIO pin for the same. This is the reason why your code is not doing anything. Your code is working properly but its not doing anything because through that A0 pin you can’t use the digitalWrite / any write command.

I hope you will understand the reason behind that :slight_smile: Do close the query if it solved the problem

Thank you, it helped me :slightly_smiling_face:

1 Like