Hi, I have tested and work very god xD
It is a simple switch...
What are the advantages of using an analog pin?
And If I use one analog pin can I use the same code that CrossRoads wrote and just change the Pin number?
I'am only asking this because in the code there is "digitalRead" and "digitalWrite" but I read that analog pins can behave just like digital pins.
Or I have to change it to "analogRead" and "analogWrite"?
I also want to detect when I have a power outage
. So I have a UPS with 4 battery's that can run the arduino with no problem when eletricity is gone. So I thought in this:
- Conect a adapter to the eletricity out of the UPS system. It is a DC-3V - 500mA adapter.
- Conect the plus of the adapter to arduino and read the value and the ground to the ground of arduino.
- When there is power arduino will read some value, and when there is a power outage arduino will read zero.
So by doing this I will damage arduino because I have heard of 40mA limitation (the adapter is only 3V but it is 500mA) on the pins but on the other side I read also that some people could detect when there is a power outage by this way.
I need some help here to know what should I do to detect a power outage with this adapter and without destroying Arduino.
People you have been great so far. Thank you so much