How to know that I may or may not use interrupt?

I have just downloaded Firmata Sketch from Arduino VB Lab - Browse Files at SourceForge.net
Then I had been told that the sketch can not execute interrupt.

I wonder how I know whether the sketch may or may not execute interrupt.
Any help?

Vielen Dank.

From within the interrupt routine, turn on a LED.

Yes I can turn on the LED.
Would you mind explaining me more details?

Thanks.

Not sure how much more detailed I can get wihtou you really explaining what you are trying to do?

The Firmata libraries use a callback, not an interrupt. This sort of works like an interrupt in that your software function is just invoked when needed, but you should look at the example code to work it out. My point is that if you want to have a visual confirmation that the routine has been called, you should change something you can see outside of the program that is running. A LED is an obvious choice. An alternative is to increment a number that you can display outside of the callback (ie, in a global variable).

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 wonder how I know whether the sketch may or may not execute interrupt.

There is no use of interrupts within the Firmata sketch. If you wanted to add interrupt handling you could modify the sketch. What do you want the interrupt to do?

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

Yes, same principle. Just put the code to turn the LED on in the function that you want to check is executing.

I want to make pin 12 as switch that is controlled from GUI, but so far it doesn't work well.
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.

My analog pin in Arduino UNO is not really stable, even if I have set them (A0-A5) as output not input, always be disturbed by my finger or anything around it.
Even if I put my sensor on A0, but the GUI show that A1 and A2 also like detect something A0 detects, it's weird.

I think the interrupt is the way to fix it, so the pin responds only if there is input from user and sensor.

I hope it is clear enough, do not hesitate to ask.

Thank you.

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?

I 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.

marco_c:
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?

I 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.

for the Arduino I use USB cable...
For my other components (IC, 7segments) I use DC Power Supply, it works well

Yes I have GUI that provide option whether make pin 12 as input, output or servo.
So which part of my Arduino I must pull down?
see this: Inputs

The link describes what you need to do. Exactly how you apply it to your project you will need to work out for yourself as you have not posted a circuit or any code.

USB can have varying voltage. Make sure you actually check you have good power with a voltmeter.

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.

An interrupt is like a ringing telephone. It signals that a need for action exists. That has nothing, NOT A THING, to do with your problem.

Using Firmata on the Arduino means that you have given complete control over what the Arduino does to another application. There is no way that interrupts are compatible with that concept.

If setting pin 12 as an OUTPUT, and setting it HIGH does not produce a stable 5V, then you have a code problem or you have damaged the Arduino.

What is connected to pin 12 that is not seeing a consistent 5V? What is the GUI doing to that pin?