No response from

Hi all. I am trying to use my slider on App Inventor to change the speed of my shield motor, but it seems like the slider only turns the buzzer and LEDs on when it reaches a certain number.


I was wondering if anyone would know what went wrong and why.

It seems like there might be an issue with how you have set up the slider and its associated components in MIT App Inventor. Let's go through the steps to properly control the speed of the shield motor using the slider.

Assuming you have the following components in your MIT App Inventor project:

  • Slider: For controlling the motor speed.
  • Button: To start/stop the motor.
  • Buzzer and LEDs: Additional components you mentioned that are mistakenly affected by the slider.

Here's the step-by-step guide to properly control the motor speed using the slider:

  1. Make sure you have correctly connected and initialized the motor shield or driver to control the motor. This might involve setting up pins, PWM channels, or other configurations depending on the motor shield you are using.

  2. Configure the Slider component:

    • Set the Range property of the Slider to match the range of motor speed you want to control (e.g., 0 to 100, if you want to control the speed as a percentage).
    • Set the StepSize property to an appropriate value (e.g., 1) to control how much the slider value changes when you slide it.
  3. Use the Slider's ValueChanged event to adjust the motor speed. When the Slider's value changes, it should trigger this event. In the event handler, you can get the Slider's value using the Slider.Value block.

  4. Use the Button component to start and stop the motor. You can use a global variable (e.g., isMotorRunning) to keep track of whether the motor is running or not.

  5. Inside the Button's Click event handler, you can check the value of the isMotorRunning variable. If it's false, that means the motor is not running, so you can start the motor and set isMotorRunning to true. If it's true, that means the motor is already running, so you can stop the motor and set isMotorRunning to false.

  6. Now, in the Slider's ValueChanged event handler, you can adjust the motor speed only when the motor is running (i.e., isMotorRunning is true). Use the value from the Slider to control the motor speed.

  7. Make sure the code for controlling the buzzer and LEDs is separate from the code for controlling the motor speed. They should not be directly affected by the Slider component.

If you follow these steps, you should be able to control the motor speed using the slider without affecting other components like the buzzer and LEDs. Double-check your code and component setup to ensure everything is properly wired and configured..