Could I connect a device that requires minimum 5V 1A from the 5V Pin to the Ground and somehow turn it off inside a sketch?
edit: I'm using a Due based boad, the digix http://digistump.com/wiki/digix/tutorials/basics
You would use a transistor. Something like this would work.
In this case the Arduino controls a transistor to drive a brushless motor.
Source: Arduino Cookbook: (https://www.inkling.com/read/arduino-cookbook-michael-margolis-2nd/chapter-8/figure-8-9)
Update: For the sake of clarity I should point out that the TIP102 is the device to use for the 1A required (not the 2N2222). And as pointed out by others the 5V supply of most Arduino boards would not be sufficient to supply 1A, so an external supply would be advised.
Short answer: NO. It would fry your Arduino.
The current of Arduino pins is very limited (40mA max on UNO).
If you need to draw 1A, then you need a transistor between the Arduino pin and your device.
In such case, what you would normally do is:
Note that you don't need to use an analog pin for that, a logical pin is enough if you just want to switch the device on or off.
Now notice that I specified a 5V 1A supply, that should normally be distinct from the 5V pin of the Arduino.
So the next question is: can you draw 1A out of the Arduino 5V pin?
The Arduino UNO page does not specify the current limitation on that pin. However it mentions the following:
So the max current on this pin depends on 2 factors:
If you use USB as power supply, then you are limited to 500mA as stated in the Arduino UNO page:
If you use an external power supply that provides at least 1A, then we have to find out the max current by ourselves.
If we take a look at Arduino UNO schematics, then we see that this regulator is referenced as "NCP1117ST50T3G" (this is "U1" on the top-right corner).
The spec sheet for this regulator mentions that it can supply 1.0A.
So in theory, that should work, however, you also have to consider that this regulator also supplies current to the Arduino borard itself and all its pins.
If you love your Arduino and don't want to fry it, you should probably stay away from using its 5V pin for your purposes.
Now if you're open to experiment, you may try it :-)
The simpler solution is to power Arduino from some external supply, then fork that power through a relay to controlled device.
Then you can switch the device by controlling that relay through your digital pin.
Have you try using a digital potentiometer name AD5220, it let you adjust the resistance with using your hand. You can find more info about it at www.analog.com. I would upload an image of the schematic but i just don't know how.