Need help for my project
i want to add some values with terminal ex 29, 140, or even 0
but what i do is not increase by adding new and previous value instead just changing the previous value
It’s almost impossible to work out what it is that you are trying to achieve from your description and code snippet, but at a guess your issue may be connected with the scope of the variables that you’re using, as you appear to be declaring them locally. I’d guess that you may also have the same variables declared globally?
I’d suggest that you explain the problem differently, add some serial print statements that print the values of your three variables at each stage of the process, and include your full code and serial output in your next post.
Also, the Terminal widget is a very poor way to input numbers. You’d be far better using the Numeric Input widget, but of course you’ll need a Plus subscription to obtain access to that widget.
ignore my snippet and about terminal widget, please help me, give some example about input numeric values who can continue added with the last input value, my problem is when i input 10 then 10 again it’s not 20, but still 10
Also, you are defining (creating a new instance of the variable with a value of zero) the Evalue variable each time this code executes…
So, as I suspected, the issue is one of variable scope, because it seems that Evalue should have been declared globally (near the top of your code) and not locally within the void loop function, or within whatever function you move it to when you sort-out your void loop.