LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help for my calculator

Solved!
Go to solution

Hi, my calculator work but i have no idea for two bouton and save result in .txt thanks for your help 

0 Kudos
Message 1 of 9
(4,268 Views)

Hi Wootchi,

 

to save data to a text file you should use the WriteTextfile function...

 

What kind of idea do you need for "two buttons"?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(4,228 Views)

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.)

0 Kudos
Message 3 of 9
(4,220 Views)

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

0 Kudos
Message 4 of 9
(4,211 Views)

A button to put decimal points and another to put + or - before the number but I do not know where to start.

 

0 Kudos
Message 5 of 9
(4,210 Views)

Search the forum for calculator.  There have been dozens of attempts by various users over the years that might give you ideas.

0 Kudos
Message 6 of 9
(4,171 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(4,061 Views)
Solution
Accepted by topic author Wootchi

@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).

0 Kudos
Message 8 of 9
(4,021 Views)

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.)

 

altenbach_0-1577579004412.png

 

(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.)

 

0 Kudos
Message 9 of 9
(3,962 Views)