Pin functions

26 Oct 2010

Is it possible for a pin to be able to assigned to interruptin and digitalin fuctions together? It compiles but will it affect it in any way? Also is there any way I can disable the interrupt?

I have an IR detector (TSOP1738) attached to pin number 21. Idea is that it will generate an interrupt on reception of the command and then using the digitalIn api I will be able to read the rest of the command bits.

26 Oct 2010

Christian, Can you give an example of how you would debounce a switch using this method? I'm looking to do some work with switches and am looking for ways of debouncing

p.s. sorry if this is a bit off topic!

26 Oct 2010

Hi,

You can always read the value of an InterruptIn pin, so no need for the additional DigitalIn object:

Simon

26 Oct 2010

Thanks for that, it works great. But what is the purpose of the second nested if statement on line 8?

26 Oct 2010 . Edited: 26 Oct 2010

Thanks,

Just 1 more question...

I am using pull down resitors on the switch, does the interrupt.mode mean these are not needed (i.e. switch.mode(PullDown))

Martin

26 Oct 2010

Hi Martin,

That is my fault. I seem to have not documented it. It is just the same as DigitalIn i.e. just assign something using =, or call .read().

Simon

26 Oct 2010 . Edited: 27 Oct 2010

I created the following extnsion to DigitalIn to add simple deboucing of an input if anyones interested.

DebounceIn

27 Oct 2010

Great discussion and yeah, clears every Question I had. Many thanks. Loving my mbed.

27 Oct 2010

Great discussion and yeah, clears every Question I had. Many thanks. Loving my mbed.

27 Oct 2010

Great discussion and yeah, clears every Question I had. Many thanks. Loving my mbed.

27 Oct 2010

Whoops, Sorry, I think the mouse buttons need a little debouncing themselves!!

27 Oct 2010

Hello Guys ,

I am a new mbed's user.I am try to buy a new encoder(cyntron RE08A) in order to control a servo. The problem its output is 5.0V(sin). Do you know if this encoder is worth to buy?I saw people that only use between 0-3.3V (is there any risk that I will fry the mbed)?