Run certain code when pressing a button.

Hi,

Is it possible to make the arduino interact live with my computer?

For example:

Is it possible to write a code, which enables voltage on pin 12 when you press the enter key on your computer? Or any other key?

EDIT: I'm thinking of writing something in Python which runs a specific .ino file when a certain key is pressed in the console, will that work? Would the .ino file get automatically uploaded to the arduino? Or is there an easier way to do this?

There can only be one program on an Arduino at any one time. You upload the program using the Arduino IDE and it will then run everytime the Arduino is powered up. There is no need to reload the program each time.

The Arduino program could certainly be written so that it does digitalWrite(12, HIGH); when it receives a message from a PC program. You probably also need another message to turn that pin off.

This Python - Arduino demo might get you started. Have a look also at Serial Input Basics

...R