Please help me out!
Hugh
Posts: 362
Hi Guys,
Its late. I'm tired. Please help me out!
I have a Long named AnsaA, which will have a value between 1 and 60.
I want to draw a chain of hyphens on an LCD screen to represent the value of AnsaA, fifteen hyphens being the maximum. The current code:
doesn't work - I assume due to a property of integer maths that means it wants to draw several hundred hyphens (which is what happens)
Have I missed something?
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:55:28 AM GMT
Its late. I'm tired. Please help me out!
I have a Long named AnsaA, which will have a value between 1 and 60.
I want to draw a chain of hyphens on an LCD screen to represent the value of AnsaA, fifteen hyphens being the maximum. The current code:
repeat ((AnsaA*15)/60) LCD.str(string("-"))
doesn't work - I assume due to a property of integer maths that means it wants to draw several hundred hyphens (which is what happens)
Have I missed something?
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:55:28 AM GMT
Comments
Right now, you've got your long times 15! That's an awful lot of hyphens. Why not take your long and divide by 10, for example. That would only be 6 hyphens.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Safety Tip: Life is as good as YOU think it is!
Have you tried just a simple division, without the multiply step, and have you verified that the value does, in fact, range 0 to 60?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Safety Tip: Life is as good as YOU think it is!
I'm now wondering whether I have an accidentally nested repeat loop. Time for sleep...!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hugh - the thinking woman's Geoffrey Pyke.