NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » Simple Bar Graph
January 18, 2011 by cmelia |
I need some help creating a simple one line bar graph using black squares indicating the ADC reading. Let's say no blocks for 0 and 20 blocks for 1024. All the other code I found online required additional libraries which I am not quite ready for. Thanks in advance. |
---|---|
January 18, 2011 by bretm |
Something like this?
|
January 18, 2011 by cmelia |
Thanks for the quick reply. The code seems very logical but I cant get it to work. I wrote it to line 4 and it dimly highlighted lines one and three when running. Have you tried this? Thanks!! |
February 25, 2011 by SpaceGhost |
I'm having trouble figuring this one out too... Same results as cmelia. |
February 26, 2011 by SpaceGhost |
I've played around with this for a while today, and this is what I have. It's pretty close to working right - problem is, the first "bar" of the bargraph comes in at about 52 of the ADC value (which is what I would expect), but on the first line of the LCD & last (20th) position.
This is of course a modified version of the tempsensor project. I incorporated the bargraph code (attempted anyway) and removed the temperature information. I am using a 2k trimmer pot with a nice thumbwheel in place of the LM34. When the ADC value hits 100 the first bar jumps down to line three, after which the second bar appears (following the first) at ADC value 104 as expected. I understand (I think) that the first bar gets "pushed" there when line one "grows" a space, after the ADC increases from a two digit number to a three digit number... However I am unable to get the bargraph to begin on line three - even by adding another space after "of 1042"... The rest of the bargraph works fine after the second bar appears - the graph increments left or right across line three according to the rotation of the potentiometer, until... After the bar reaches position 19, at 20 (full scale) the first bar on line three "disappears." I believe the issue is all about getting the bargraph to start (@ ADC value 52) on line three instead of one. The problem may be obvious, but I'm sure missing it!
One last thing I think I should mention: When loading the code I get a "warning" message - unused variable 'lcd_stream' (referring to line #66). Not sure what to do here either... What to replace it with, or whether to delete it? Could this be part of the problem? It was fun getting this far with it, but now I'm kinda stuck! |
Please log in to post a reply.
Did you know that you can build a digital read out (DRO) for a lathe or milling machine? Learn more...
|