05-08-2014 10:53 PM
apok wrote: weird...7 segments are always indicators?
The problem description is clearly the reverse operation, and he even included a passworded solution that defines the exact required behavior.
Imagine you would have to write an application to read a 7-segment LED display with a camera and recogize the displayed numerical value. I outlined a solution higher up and was able to implement it in a few minutes. Works just fine.
Part of solving a problem is to actually read every word of the problem description, and not make assumptions after reading 30% of it. 😄
05-08-2014 11:06 PM
@altenbach wrote:
apok wrote: weird...7 segments are always indicators?The problem description is clearly the reverse operation, and he even included a passworded solution that defines the exact required behavior.
Imagine you would have to write an application to read a 7-segment LED display with a camera and recogize the displayed numerical value. I outlined a solution higher up and was able to implement it in a few minutes. Works just fine.
Part of solving a problem is to actually read every word of the problem description, and not make assumptions after reading 30% of it. 😄
thanks..
05-08-2014 11:07 PM - edited 05-08-2014 11:13 PM
@apok wrote:
get 7 leds into a cluster, reorder them (a-g) as #0-7 and use the array to cluster function...dont forget to size that function,otherwise broken arrow. make your pattern with your bool arrays into a 2D. then just index the # to output the 1D pattern that matches
Well, this is not the problem here, but here's an old VI I wrote in 2010 that does the same in much more readable code 😉
Back to the problem described in this thread:
It could easily be adapted for the current reverse problem using (1) "search array" and (2) deal with the situation when the pattern is not found.
Should take less than a minute....
05-08-2014 11:36 PM
Didn't & segment displays use a BCD to encode and decode the segments ?? any one? I kinda remeber that for some reason ?LOL 🙂
HTH
My .02
22v10
05-09-2014 12:54 AM - edited 05-09-2014 01:18 AM
here's something fun.....hijack'd
EDIT: did not take care of the ZERO's left of the numbers as thought...late nite, will work on it in the morning
05-09-2014 01:00 AM
In my opinion you should use a 7 segment FONT. Don't do all that work with boolean.
Use an indicator for string or number, change FONT to 7 segment, change color to your choice, THATS ALL!!!
Use Google to find 7 segment fonts...
05-09-2014 02:02 AM
@sjunge wrote:
In my opinion you should use a 7 segment FONT. Don't do all that work with boolean.
We are probably all well aware of the 7-segment font. This thread is about the reverse problem, translating an LED pattern into numbers, so a "7-segment font" would not be a solution.
Also, the "number-to-7-segment LED problem" was one of the tasks at the NI week 2010 speed coding challenge (AKA "beat Darren" :D), it is a demonstration of coding skills. Maybe you want to drive real discrete LEDs with digital outputs later, again a case where a 7-segment font would not work.
05-09-2014 02:17 AM - edited 05-09-2014 02:17 AM
@apok wrote:
here's something fun.....hijack'd
Here's a 10digit version I made back in 2010. (use format %010d to show leading zeroes).
05-09-2014 09:02 AM - edited 05-09-2014 09:18 AM
i hope i did not rube on this, but it took care of the leading zero's...
05-09-2014 12:53 PM - edited 05-09-2014 12:56 PM
@altenbach wrote:
Back to the problem described in this thread:
It could easily be adapted for the current reverse problem using (1) "search array" and (2) deal with the situation when the pattern is not found.
Should take less than a minute....
Here is a partial solution to get you started. You still need to deal with the case where the output is -1 and change it to 11 (e.g. using "less than zero" and "select". Personally, a -1 is a more intuitive output, but does not correspond to your requirements). You also might need to change the cluster order so it corresponds to the order you wire the switches into the array before converting to a cluster. The nice thing with this method is that all patterns are nicely visible and can easily be changed if the patterns are slightly different (for example, your "9" does not light up the bottom LED, but mine does).
If you want fuzzy matches, use the lookup table solution I explained earlier. Now you can have multiple patterns that resolve to "9". try it too!
Also note how much uglier and confusing the code would look before this idea was implemented. 😄