I wonder how I know whether the sketch may or may not execute interrupt.
So, what you are trying to tell me to try whether the interrupt works or not?Similiar to this example: http://www.dave-auld.net/index.php?option=com_content&view=article&id=107:arduino-interrupts&catid=53:arduino-input-output-basics&Itemid=107
I want to make pin 12 as switch that is controlled from GUI, but so far it doesn't work well.
I don't think that interrupts will fix your problem. - It could be that you have a bad power supply - are you providing the Arduino withthe right voltage to function?QuoteI want to make pin 12 as switch that is controlled from GUI, but so far it doesn't work well.By this I understand that you have a GUI somewhere that sends a signal to the Arduino and the Arduino turns on the output? Or is Pin 12 an input? For either case- Have you actually configured this as an output? Posting your code will help to determine what is wrong- For inputs you need to have pull-up or pull-down resistors on the inputs so that they will work. With nothing connected to an input it is not 0, it is undefined, and it will react to fingers and moisture and anyuthing you can imagine. Look it up for details.
When I make pin 12 as the OUTPUT, it is not really stable to hold the switch in HIGH voltage (5V),so I think it might be due to waiting for another code executed, so I think I should use interrupt to fix it.