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!



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…

Problem is here…
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:

But the global name is taking the values:
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…
where did you get that synchronous method from?

these guides from @juananton1991 might help


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…


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.