AnalogIn as AnalogOut

Hi Guys!!

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


There is only one analog output

Hi Gus,

Thanks for reply.

I am asking you because I saw in following link [url]Colorduino Library for Arduino – Lincomatic's DIY Blog the
Colorduino Shield using 3 Analogic Input ports as Analogic Output ports… Could you see too?

Thank you.

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 ( ) :

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


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.

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


@ 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).

@ 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)…

I will modify my question…

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

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.

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

Thank you :smiley:

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

See here and note “secondary feature”

So to answer your question, yes you can

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

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?

Gus I will gonna read the eBook…

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()…

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


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.