Comparing values

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Comparing values

Post by Tony Brown »

Hi All

I am trying to compare two values and display a 'dot' on a LCD as the values become closer to being the same, one of the numbers is fixed (set as a delay) whilst the other number is the count down. The dots would be like a percentage ie, at 10% of the delay being reached one dot would be on and at 100% all dots would be on.

Anyone have any ideas.

Thanks in advance :-)

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Comparing values

Post by medelec35 »

Hi Tony,
I have moved post to V5 section since your a V5 registered user.

What number range have you got in mind?
E.g delay could be from 1 to 1000 ms for example

Or is range just a byte so delay could be from 1 to 255 ms?
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Comparing values

Post by medelec35 »

I have attached a flowchart that will automatically calculate percentage from two numbers, Then will display as full stops across the bottom row depending on percentage results.
Not using floats, to keep ROM usage down.
The 90 choosen is just a random fixed number. That can be changed to your fixed number but only in the byte range until bytes are changed to integers if higher range is required.
Percentage shown on the top row of LCD is not count + 1, its the results from actual percentage calculations.
Flowchart can be modified so dots don't briefly flash when incrementing. I can sort that if required.
This way makes it a bit easier to follow.

I did count up and not count down, but it could be changed to count down.

Martin
Attachments
Percentage.fcf
(11 KiB) Downloaded 336 times
Martin

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: Comparing values

Post by Tony Brown »

Hi Martin

Thanks for fast response, basically it's similar to the timer delay that you sorted for me with the time lapse project, so you select the time delay ie hours, minutes and seconds, as the delay is getting to 0 it is giving a dot for the percentage of time elapsed as an indicator for how much time is left.

Hope you can understand my question.

I tried converting the time delay to seconds and was going to try and work out the percentage from that but am not sure how to continue so your help is most appreciated.

Tony

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Comparing values

Post by medelec35 »

Hi Tony,
No problem,
You want 0 seconds left = 100% and the start of the timing period to be 0%?
So i'm editing correct flowchart, If you post the flowchart in question, I will edit it for you.

Martin
Martin

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: Comparing values

Post by Tony Brown »

Hi Martin

Yeah start at 0% and end at 100%.

It's really useful having this forum and people like you on it, im learning so much.

Thankyou

:-)

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Comparing values

Post by medelec35 »

No probs.

If you're using full stops, are they to replace count down time, or pics taken, or you going to use a LCD with more lines?
Martin

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: Comparing values

Post by Tony Brown »

Yes im just making a timer that does not show the count down but uses full stops as an indicator of the amount of time passed.
I also do not need the trigger as it is just a count down timer.

Thanks

Tony

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Comparing values

Post by medelec35 »

Hi Tony.
I have altered flowchart so hours, mins and secs can be set. then when time is counting down, dot indicates from 0 to 100% time elapsed.
I will post it, but I don't know what you want to happen once time has elapsed?

Martin
Attachments
Count Down timer V1.fcf
(47.2 KiB) Downloaded 325 times
Martin

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: Comparing values

Post by Tony Brown »

Hi Martin

Thanks for that, that will really help me.

I will be using it for something I want to make for work, it is going to be used to switch a device off and I thought the dots would make it abit different.

Thanks again for that :-)

Tony

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Comparing values

Post by medelec35 »

Hi Tony,
Just a thought.
If time period if fairly long, just seeing up to 16 dots will take some time to appear.

How about using custom characters?
As you may already know each char consists of 5 ×8 dot character fonts.
So you could either get one row at a time to be displayed, eg:
Different idea.png
(10.83 KiB) Downloaded 4324 times
You can see four steps (percentage calculations) has elapsed and not even one Char has been completed.
Of course if time set was a lot less e.g a few seconds then all 16 chrs will be filled in with all 8 rows completed.

You may remember I posted information on creating custom chars here:
http://www.matrixmultimedia.com/mmforum ... tom#p45599
Martin

Post Reply