.... I meant you App code
If you are using Serial.readStringUntil() in the Sketch, the value sent by the App can only be a single String, not a List (not an array).
So you have tried this:
... and it results in the error you reported?
.... I meant you App code
If you are using Serial.readStringUntil() in the Sketch, the value sent by the App can only be a single String, not a List (not an array).
So you have tried this:
... and it results in the error you reported?
No, because your Sketch Code is processing only 1 string, not a List of Strings
yeah, how do you make it a string instead of a list?
The WriteStrings Block will send a single string or a List of strings. If you don't want a List, send a single value - or change how the data is received/processed in the Sketch.
Arduino C does not have particularly good string splitting functions.
is this really the best way of going about things? cant i just send it as an integer and read it also as an integer in the arduino code? the only problem with that is that it reads wrong
cant we just try to fix that?
First things first, did you try my App code snippet? Error or OK?
its an error
Please download and post each of those event block(s)/procedures here ...
(sample video)
Back to basics:
Please answer these question just as I have listed
OK - progress. Less haste is the message!
I think you probably made the wrong Bluetooth choice, there doesn't seem to be anything in your Project that benefits from using BLE instead of BT Classic.
I don't understand your "Real Servo" code but it seems to differentiate between the possible sources of the integer value.
Instead of: Serial.readStringUntil('\n');
We can try: Serial.parseInt() (therefore Secondinput should be initialised as an int)
well its not really benefiting from BLE, i just have BLE laying around so i kind of just used what i have lol
so like before, its reading, its just not returning the right values, the value on the first slider should be between 1000-1100, and here im getting numbers like 0,4, and 7
OK, try Write Bytes instead of Write Int (Fields of Block same as Int)
Failing that, we can return to sending a single string like so:
its the same but with wilder numbers getting longer the longer i moved the slider
im going to try the single string now
aw man, more gibberish
this is the code block
here's the snippet of the code
if(Serial.available()>0){
String Secondinput = Serial.readStringUntil('\n');
Serial.print( "SecondInput(" );
Serial.print( Secondinput );
Serial.println( ")." );
int RealServo = Secondinput.toInt();
Serial.print("Real Servo = ");
Serial.println(RealServo);
also i want to ask why "\n" is strung in with thumbposition? whats "\n" for?
That should be write strings!
(and read until \n in the Sketch)
It signals "end of string" for Serial.readStringUntil('\n');