12-27-2019 03:01 PM
Hi, my calculator work but i have no idea for two bouton and save result in .txt thanks for your help
Solved! Go to Solution.
12-27-2019 04:47 PM
12-27-2019 05:08 PM - edited 12-27-2019 05:12 PM
Well, the two buttons are for the decimal point and sign (positive/negative), so you just need two more cases to handle them. What have you tried?
Who wrote the code?
(Also note that the boolean text for all buttons have a solid grey background. Should be transparent. Also, your loop needs a small wait. Currently it is using 100% of a CPU core, polling the buttons millions of times faster than you can possibly press them.)
So save the result to a file, you need yet another button ("Save", "write to file", or similar.)
12-27-2019 05:40 PM
I created it but I am a french student and I start on labview.
I know that there are buttons missing and for the color I unfortunately colored a button and did not manage to make it transparent so I did everything the same.
for the 2 button I don't know where to start...
Thank you for your answers
12-27-2019 05:42 PM
A button to put decimal points and another to put + or - before the number but I do not know where to start.
12-28-2019 12:41 AM
Search the forum for calculator. There have been dozens of attempts by various users over the years that might give you ideas.
12-28-2019 09:28 AM
Hi Wootchi,
@Wootchi wrote:
I created it but I am a french student and I start on labview.
To start with LabVIEW (notice the different capitalization of the word LabVIEW?) you should take note of those "Training resources" offered in the header of this LabVIEW board!
12-28-2019 04:04 PM - edited 12-28-2019 06:21 PM
@Wootchi wrote:
A button to put decimal points and another to put + or - before the number but I do not know where to start.
Your somewhat painted yourself into a corner with the current attempt. At this point, you should take a step back and re-think your overall code design. While implementing the extra functionality in the current code is possible (+/- would negate the number while a "." would change to an appropriate fractional multiplier (0.1, 0.01, 0.001, etc.), it might be significantly easier to change your indicator to a string. Now you don't need any math, just append 0..9, and "." and toggle prepending a "-". The string value can be turned into a DBL at any time math operations are needed.
Very little change is needed to go that route and it will significantly simplify everything. For example you would need many fewer cases and don't need that scaling value in the shift register. And as mentioned, you loop needs a small wait (or an event structure instead of a case structure).
12-28-2019 06:27 PM - edited 12-28-2019 06:28 PM
Here's a simple draft to show how that could look like. (just a quick draft. I am sure there are bugs ;). Still, it can possibly give you some ideas. Make sure to understand every detail or come back and ask.)
(I left your basic logic in place. Of course now you should expand it to a stack of entered values and operations and apply correct precedence, etc.)