Help! Bad Argument to +

Please help me. I m facing below problem​:point_down:

Blocks are below :point_down:

You cannot use math variable for webstring

global name is empty so you cant add

No, I can use.Sorry but It’s not solution.

Yes, I know sometimes the output of sensor is empty but what’s the solution?

Maybe you could use an if, then statement for example if output of sensor is empty do …else proceed with the code that you already have

I m doing same in if, else . :point_down:

But, It’s not working.
Hope you will guide me. …

Yes, I have done it. But it’s not working… I m trying again…

DId you see ?

Yes; it is not creating problem anyway. Problem is in empty value of variable but solution is not available.

if you take a look at the error message, you will realize, that you receive the invisible new line character \n… and the + block only accepts numeric values

this statement is wrong!

Taifun

2 Likes

Thanks for reply and giving me right opinion. I respect your opinion.
Then what is the solution to handle /n ???

it is \n (backslash n) and not /n (slash n) …

I’m not familiar with the Arduno.Read method…
what kind of response do you expect?
you might want to adjust your Arduino code to prevent sending an empty \n without any data…
Taifun

Problem is here…
:point_down:
There is a string of output values of Arduino and this global name is not taking the value according to that string of numbers. Suppose the Arduino output values after 500ms delay are:
1400.25
1222.50
2558.90

But the global name is taking the values:
1400.25
122
2.50
\n
2558
.90
\n
While I have given value 500ms or nearby value to clock interval.
Please give a solution. :pray:

after looking into the documentation I can see, that the Read method is an asynchronous method…
https://docs.kodular.io/components/connectivity/arduino/#read
where did you get that synchronous method from?

these guides from @juananton1991 might help

Taifun

Hope this will helpful :pensive:
But I am using Arduino usb serial extension so it is not helping me.
I think extension needs some update.
Thank you for your opinions and time.

I think, your logic needs some update… :wink:
but you also could try the built-in Arduino component…
and search the MIT App Inventor community… you will find loads of threads about communication between Arduino - App Inventor… your problem is a standard problem…
sorry, I’m not an Arduino expert…

Taifun

Ok, the problem is in Synergy between clock interval and delay() , that i have discussed above. So when I was playing with clock block then it shows something good result. Now I am getting non deprecated values. But some deprecated values are also exist while\n is completely vanished. :stuck_out_tongue_winking_eye:

I was banging my head against a brick wallwall.

Yes, there is a component called serial. I have tried it, problem is same.