Need someone to help my remote control

I just start this project and find It doesn't work. I created a slider and seems it's gonna send values to Arduino. I currently want to use this slider to control the servo motor, but I got no luck. any help would be appreciated.
UCCApp.aia (1.6 MB)

#include<SoftwareSerial.h>
#include <Servo.h>
Servo myservo;
SoftwareSerial BT(10, 11); // RX, TX
int Position ;

void setup()
{
  myservo.attach(4);
 //BT.begin(9600);
  BT.begin(9600);
}

void loop()
{
  if (BT.available() > 0)
  {
 int Position = BT.read();
   Position = map(Position, 0, 180, 0, 180);
    myservo.write(Position);
    //delay (100);
  }
}

The Blocks are using a Steering Wheel, not a Slider?

No ChrisWard. It’s not a slider. I use a canvas and a ball to make a slider to do the same as a slider.

What data type does this return?
And how many bytes does it return?

I currently got some weird values. Some are negative which I wish not.

This is what I have the blocks so far and I got these values
image
image

Do you have a link to the documentation of that read() function?

Nah, mate. I studied all those from our community and Arduino community. So far I could understand Serial. ParseInt(). This is way I currently convert string from MIT.

This looks more useful:

This is a great help! I just updated the Arduino code and also make a few changes to MIT App. So far I got weird behavior from the servo motor.
1 the servo motor is vibration itself when I don't slide.
2 the acting speed of the servo motor is far behind I push the slider to the left or right.

#include<SoftwareSerial.h>
#include <Servo.h>

int servoAngle = 0;
int Position ;
String texto;
Servo myservo;
SoftwareSerial BT(10, 11); // RX, TX


void setup()
{
  myservo.attach(4);
  //BT.begin(9600);
  BT.begin(9600);
  //BT.setTimeout(25);
  Serial.begin(9600);
}

void loop() {
  if (BT.available() > 0)
  {
    texto = BT.readStringUntil('\n');


   //Serial.println(texto);
   servoAngle = texto.toInt();
    //int servoAngle = map(Position, 0, 180, 0, 180);
    Serial.println(servoAngle);
    myservo.write(servoAngle);
    delay(100);
  }
}
[UCCApp.aia|attachment](upload://5EQj4hWZ8A4QAVTbEN3DzStQIRb.aia) (1.6 MB)


Do you have to write to the servo motor if the incoming data does not change?

The servo motor is to be set to 90 degrees because I need to keep it stays at the middle. Then I could decrease or increase the degree to control the car turn left or right.

after all, I learned a lot from this great community and I get my horizontal joystick works fantastic! but I got a problem with the servo motor. as you can see it shakes when it's at 90 degrees. what will cause this problem? I have scratched my head day by day and I could not figure it out.

#include<SoftwareSerial.h>
#include <Servo.h>

int servoAngle = 0;
int Position ;
String texto;
Servo myservo;
SoftwareSerial BT(4, 12); // RX, TX


void setup()
{
  myservo.attach(3);
  //BT.begin(9600);
  BT.begin(9600);
  BT.setTimeout(50);
  Serial.begin(9600);
}

void loop() {
  if (BT.available() > 0)
  {
    texto = BT.readStringUntil('\n');


    //Serial.println(texto);
    Position = texto.toInt();
    servoAngle = map(Position, 0, 180, 45, 135);
    
   
    servoAngle = Position;
    Serial.println(servoAngle);
    myservo.write(servoAngle);
    //delay(50);
  }
  
}

UCCApp_cancasControl.aia (1.6 MB)

I regret I have no experience with servo motor control.

I suggest searching this board for 'motor' or 'servo motor'.