Tilt Control Tests

Test the Tilt Control System

Follow these step-by-step instructions to test the tilt-drive and Gripper control features of the remote controlled cyber:bot with Gripper and Feedback 360° servos.

  • Hold the micro:bit tilt controller level with its LED display facing the ceiling and the gold edge connector pointing away from you.
  • Set the cyber:bot robot with Gripper on the floor and set its PWR switch to 2.
  • Tilt the micro:bit controller away from you, so the gold edge is lowered a little. The cyber:bot should roll forward.
  • Also try tilting the micro:bit controller toward you, so the gold edge is raised a little. The cyber:bot roll backward.
  • While rolling either forward or backward, try tilting the micro:bit controller left and right by lowering one hand then the other. This should add turning.
  • Hold the micro:bit controller level again to make the cyber:bot stop.
  • Press/release the B button, and verify that the Gripper closes and lifts.
  • Press/release the A button,  and verify that the Gripper lowers and opens.


How It All Works

The scripts in this activity are just slightly expanded versions of the ones from the Cybersecurity: Radio Tilt Control tutorial’s Radio Tilt Controlled cyber:bot App activity.  

First, the script had to be ported from continuous rotation servo control to Feedback 360° servo control.  The changes to the script that have to be made to work with the new servos are explained in the How to Update Scripts for Feedback 360° Servos activity.

To add button control to the Radio Tilt Controller Code, the routine below was added to the transmitting tilt controller app.  It expands the dictionary to contain data indicating which of the micro:bit module’s buttons were pressed.  Before this, it just contained x, y, and needle key value pairs.

    if button_b.was_pressed():          # add
        dictionary['button'] = 'B'      # add
    elif button_a.was_pressed():        # add
        dictionary['button'] = 'A'      # add
    else:
        dictionary['button'] = 'None'   # add

 

This line was added to the Radio Controlled cyber:bot Code.  

            button = dictionary['button']  # added

 

These lines were added to respond to the button values by opening or closing the Gripper.

            if button == 'B':               # added
                bot(15).servo_angle(30)     # added Gripper close & lift
            elif button == 'A':             # added
                bot(15).servo_angle(150)    # added Gripper lower & open