Main Site Documentation

AnalogIn as AnalogOut


#1

Hi Guys!!

I will need to change the An0, An1 and An2 to Analogic Output ports… How can I change it?

Thanks!!


#2

There is only one analog output


#3

Hi Gus,

Thanks for reply.

I am asking you because I saw in following link http://blog.lincomatic.com/?p=148 the
Colorduino Shield using 3 Analogic Input ports as Analogic Output ports… Could you see too?

Thank you.


#4

I am using a rainbowduino which is similar to the colorduino ;
As far as I know, this is using I2C comunication to talk to the led matrix, so never any analog input or output are used !

As per the product sheet ( http://iteadstudio.com/store/index.php?main_page=product_info&cPath=18&products_id=312 ) :

It’s using PWM to vary color intensity.
As far as I know, the arduino do not have any analog output capability !

Cheers,
:wink:


#5

I’m unsure of the context, didn’t have time to read that page, but if its controlling a load of LEDs, with LEDs a PWM is sufficient to approximate analogue output due to the low refresh rate (for the lack of a better term) of the human eye.


#6

Hi Nicolas… could you share to me your demo code from RainbowDuino, only to study how it works!

:smiley:


#7

@ Gandarez,

I have used it with Arduino only so far, but never with Fez. It should work without any problem, as it’s using standard I2C. I will try and make you some demo code if you want next week (I have only one FEZ board right now, and it is busy long term testing another app, so I can’t reuse it immediatly :D).


#8

@ Nicolas3

Thank you so much guy :smiley: … I will try again after my work schedule… I need to understand how it works, I am a begginer in microcontrollers, but I have a good experience in C# (.NET)…


#9

I will modify my question…

Can I change the AnalogIn, An0 for example, to DigitalOut ?


#10

Do not mix analog in and analog out, they are completely unrelated. On FEZ, there is only one analog output and the same pin can also be analog input, An3 to be exact.


#11

Hi Gus, my question is to about to convert AnalogIn, An0, to DigitalOut, it is possible?

Thank you :smiley:


#12

All pins on FEZ are digital be default, some pins can be analog or other things, like SPI

See here and note “secondary feature” http://www.ghielectronics.com/downloads/FEZ/Panda_II/FEZ_Panda_II_UserManual.pdf

So to answer your question, yes you can


#13

Hi Gus thank you for your reply… Do you have any example how to turn Analogic pin to Digital pin ?


#14

You do not “turn” a pin into analog or digital, it is as simple as what code you are using. The ebook is full of examples on analog and on digital, have you looked?


#15

Gus I will gonna read the eBook…


#16

I learned how to turn Analogic Input, like An0 to Digital Output… is so simple…

private static OutputPort SB = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.An0, false);

So, I am studying about the Colorduino Shield and I am “totally lost”… because I can’t understand many particular instructions, like sei(), cli()…


#17

If you’re now stuck on SEI() and CLI(), then you’re reading the code from some other micro controller. Stop it !

:wink:

SEI and CLI are usually SET INTERRUPT and CLEAR INTERRUPT. They’re related to interrupt handling.

Often this is easier if you can get back to a more generic “what does this device need me to do” information rather than a specific micro’s way of achieving that. You do that by looking at data sheets and general instruction sets, not specific code that people have done. If the device is a composite device (made up of different parts) then you might have to look at each individual components data sheets. The Colorduino might be a difficult first project to convert since (from what I know) it’s really a customised arduino platform that handles the PWM of the RGB LED array. It also really isn’t a shield in the sense of “normal” shields that do a function and plug on top of a microcontroller platform. Good luck; perhaps now you should start a different thread just on this topic to see if anyone else has looked at it.