Slider is a proportional control item and allows to transmits to the microcontroller smooth change its position. It allows you to smoothly change the value from 0 to 100 (integer).


Slider positionunsigned char0..100 slider position


Settings of slider allow to specify the different values:

  • Variable name - name of the slider and the variable in the source code for the microcontroller, allow to set a name for the variable of C rules.
  • Orientation - You can set the orientation of the slider on the interface field. Orientation can be "vertical" or "horizontal".

Code example

To obtain the position of the slider, it needs to be read from the corresponding fields of the structure RemoteXY:

  int pos = RemoteXY.slider_1;
  /*  pos equal to the position of the slider, changing from 0 to 100 */

To control the analog signal on the output PIN of the microcontroller in the Arduino IDE you can use the following code:

  analogWrite(PIN, RemoteXY.slider_1 * 2.55);

For controlling the motor through the driver motors in the Arduino IDE you can use the following code, in which the pin PIN_DIR - the direction of rotation of the engine, pin PIN_SPD - PWM output for motor control:

  int pos = RemoteXY.slider_1;
  if (pos>50) { // up
    digitalWrite(PIN_DIR, HIGH); 
    analogWrite(PIN_SPD, (pos-50) * 5.11); 
  else if (pos<50) { // down
    digitalWrite(PIN_DIR, LOW); 
    analogWrite(PIN_SPD, (50-pos) * 5.11); 
  else { // stop
    digitalWrite(PIN_DIR, LOW); 
    analogWrite(PIN_SPD, 0); 

To control the servo to the Arduino IDE, you can use one of the lines of the following code:

  myservo.writeMicroseconds(RemoteXY.slider_1 * 20 + 500);
  /* or */
  myservo.write(RemoteXY.slider_1 * 1.8);

  /* for reversing direction */
  myservo.writeMicroseconds(2500 - RemoteXY.slider_1 * 20);
  /* or */
  myservo.write(180 - RemoteXY.slider_1 * 1.8);