Whenever you download a sketch into the Arduino, it is loaded into Flash memory.
- Whatever your program does, it is exectuting from the Flash memory.
- You can use analogRead() on 6 specific pins to read a voltage. You can use analogWrite() on 6 specific pins to output a PWM signal. With a simple Resistor/Capacitor filter (low pass filter) this can look like a DC voltage level.
- Examples are in the IDE, look in the commands across the top.
- Try some of the example sketches, and in the Learning section, to read an input to see if a button is pressed, and take actions from there.