HOME > > ARDUINO How To MAIN PAGE> > QDUINO MAIN PAGE     Delicious.Com Bookmark this on Delicious    StumbleUpon.Com Recommend to StumbleUpon

The two tri-color LEDs

The Qduino has two tri-color LEDs, for easily accessed output.

Although they are not the rather splendid "smart LEDs" I had fun writing a page about using, at least one of them is capable of multiple hues and brightnesses... almost as if it were a "smart LED".

This fairly short page will be in two halves... I will start by talking about the "User" tri-color LED. Then I will discuss the "Stat" tri-color LED.

This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a narrow window. With most browsers, pressing plus, minus or zero while the control key (ctrl) is held down will change the texts size. (Enlarge, reduce, restore to default, respectively.) (This is more fully explained, and there's another tip, at my Power Browsing page.)

Page contents © TK Boyd, Sheepdog Software, 9/15.



The "User" tri-color LED

As far as I am aware, the User tri-color LED is provided entirely for the user's programs to control. Yes, in the example program (sketch) "BatteryLevelToLED", the User LED is used to display the level of charge detected in the lipo cell... but it is done "by hand" as it were. There are no special, "direct" "connections" between any of the charge state detection provisions and the User (or Stat) tri-color LED.

The rgbLED example program, dissected in my discussion of the Qduino library and examples, allows you to set any of the LEDs in the tri-color LED module to "on" or "off" or to any of many steps of brightness in between. Hence, you can make it look red or green or blue... which would be a "pure" color, arising solely from one of the constituent LEDs, or you can produce, say, magenta, yellow, white... etc.

How is this achieved, in hardware? (You may not need this! But if you are interested....)

The three LEDs are driven by the Qduinos D10, D11 and D13 signals. PWM is used to achieve the less- than- fully- bright states.... a high frequency train of pulses is sent. For a very dim state, the signal is off for longer than it is on. For a nearly fully bright state, the signal is on for longer than it is off.

This somewhat complex scheme... all details of which are hidden for you, inside the library... worries me slightly, because I wonder about the overheads demanded of the processor... but I am often told that I worry too much.

To make a half bright red, the heart of the programming (and there's not a lot else involved, see the discussion of the library mentioned a moment ago) would be...

q.setRGB(128,0,0);

(The "q" could be something else. It is there to specify the instance of the qduino class we are using. "q" is commonly used as the name for the qduino instance, and a perfectly sensible name. But you could use something else, if you wanted to.)



The "Stat" tri-color LED

"Stat" for "status", I presume, because of what the green element in the LED tells you....

The green LED (in the "Stat" tri-color LED) is easy to cover: It tells you if a lipo cell is connected and charging.

It is driven directly by an output from the chip that controls the lipo charging... the ATmega at the heart of the Qduino is not involved.

The chip controlling the charging is separate from the fuel gauge chip, so if you have put the latter to sleep, the state of the green LED should not be affected.

I believe that the signal to the green LED is digital, i.e. the LED will be fully on, or fully off... if a lipo is connected. When a lipo there isn't connected, the green LED tends to flicker, or appear dimly lit.

When a lipo is connected, and charging power is available, the green LED in the "Stat" tri-color LED will be on, until the lipo has become fully charged, when it will go off.



That's the green LED dealt with!

I don't believe that there are any routines in the Qduino library for turning the red and blue LEDs in the "Stat" tri-color LED on or off.

The first thing to note is that the red and blue LEDs in the Stat tri-color module show the status of the transmit and receive hardware when communicating over USB. This is baked into the bootloader. The bootloader is based on the standard Caterina bootloader. On a Windows machine, patched for Qduino, you can see the code for that in....

C:\Users\XXX\AppData\Roaming\Arduino15\packages\Qduino Mini\hardware\avr\1.0.6\bootloaders\caterina

... where "XXX" is your user name. Look for lines with "TX_LED_OFF()" or "RX_LED_OFF()", or "TX_LED_ON()" or "RX_LED_ON()".

I must admit that I haven't (yet) got a clue as to what all the stuff in the Caterina code tells me. But, thank you People Who Know for your help, I am reliably informed that that is where I need to go to fully understand what is being done with the Stat blue and red LEDs.



Ever hear the one about a little knowledge being dangerous?

I'm pretty sure the following is true and safe. I know it "works"... I just don't know that there aren't unintended consequences!

Given the material just about the line, I would be a bit nervous about playing with D17 while I was using the USB channel for other things. But, if after your Qduino is programmed, you are not using the USB channel for other things I would be tempted to think the red LED might be used as follows.

The red LED in the Stat LED is on pin 17. I'm working on where the blue LED is! Just send it high or low to turn the red LED on and off... if you are feeling adventurous! I think that D17 is also used for the SPI bus "SS" signal. As I haven't used the SPI bus, I can't tell you much about its use with the Qduino.

setup()
{
pinMode(17,OUTPUT);
}

loop()
{
digitalWrite(17,HIGH);
delay(400);
digitalWrite(17,LOW);
delay(400);
}

I will qcome back to this, and say more the LED blue later! I if this is still here 15 Oct 15, please prod me!



Useful?

I hope you found this subpage of my pages about the Qduino useful? Please tell others about it, if so! Forums, Facebook, etc?






To search THIS site.... (Go to my other sites, below, and use their search buttons if you want to search them.)
Click this to search this site without using forms.

powered by FreeFind
Site search Web search

The search engine merely looks for the words you type, so....
*    Spell them properly.
*    Don't bother with "How do I get rich?" That will merely return pages with "how", "do", "I"....

Please also note that I have two other sites, and that this search will not include them. They have their own search buttons.
My site at Arunet.
My Sheepdog Software pages, another of this page's editor's sites.


Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.




Here is how you can contact this page's editor. This page, and the software it references, ©TK Boyd, 8/2015.

Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org