No announcement yet.

Blocks programming--Need help

  • Filter
  • Time
  • Show
Clear All
new posts

  • Blocks programming--Need help

    Hello, we don't know for sure if the Op Mode we wrote is good or is it our wiring (which we have checked). After we hit the INIT button, sometimes the battery level drops down to 6.7V (and that window turns red). Other times, we don't get the red light but for some reason, one of our drive motors runs by itself for a second or two. Other than that, nothing moves when we use the joystick. Im' wondering if someone can look at our code and see if anything is wrong with it.

    This is our config:
    Motor Controller 1
    Motor 1: Left drive (we have that reversed)
    Motor 2: Right drive

    Motor Controller 2
    Motor 1: Extension
    Motor 2: Shoulder

    Motor Controller 3
    Motor 1: Sweeper
    Motor 2: Lift

    Servo Controller 1
    Servo 1: Wrist

    Thank you very much for helping my team with this. I'd be more than happy to provide more details. There are a couple of other teams that need help with Blocks and we will share what we learn with them.

  • #2

    The low battery error is probably caused by your battery not charging properly, which could be a bad battery, a bad charger or a loose connection. It could also be caused by a wiring problem or a defective REV module.

    The software problem is that the program sets the motor powers to 1 rather than values of the left motor and right motor variables.

    Also make sure the Gamepad has been recognized via Start and A. See 2:30 of


    • #3
      PS It looks like you have Modern Robotics electronics so I should have referred to your power distribution module rather than your REV expansion hub.


      • #4
        Thank you. We did get the hard wiring problem resolved. We can drive with left drive and right drive, but are trying to figure out how to reverse a motor's direction using the gamepad. For example, we have a "sweeper" variable and hope to program it to move with button y, but that would only go clockwise. If we want to go counter clockwise, what command would we use? We do appreciate all your help.


        • #5
          In simplest terms, applying power values from 0 to 1 turn the motor in one direction, 0 to -1 turns in the opposite direction. You can either set your motor value to a negative value upon pressing the Y button or assign the negative value to it via multiplying your motor power variable by -1. Note that the approach for using a button to control motors is totally different than using a joystick. You will need to use a logic statement that tests the button state and assign the appropriate power to the motor. (pressed = -runpower, not pressed = 0) You may need to either use a Run using Encoder approach that uses the internal PID to invoke finer control of the motor (like if using it for an arm) or apply motor power in chunks using the loop time of the controller.


          • #6
            11343_Mentor has given some excellent hints. This video might also help although it doesn't address the question of rotating the robot.


            • #7
              Team 12227 from Barbara Bush MS thanks each of you from the bottom of their hearts. We .did use your inputs and figured out how to program with buttons (using logic). I can't wait to see if we can help another team fix their programming issues.

              FYI: One of our students had wired the positive and negative wires together. We kept getting a low voltage (6.7V) on the driver and robot stations, even though the battery had been charged. I finally removed the electrical tape to discover the left drive (two motors) wires had been wired to the red/black wires from the motor controller. So, imagine six wires all wired together. It's no wonder the bot didn't explode! Anyway, lesson learned: Do not tape or zip tie anything until you have run the bot and are happy with the config. Then, of course, cover the wires. Tomorrow, we tackle the servo programming.