Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Tilt-Control Gripper cyber:bot with Feedback 360° Servos

Tilt-Control Gripper cyber:bot with Feedback 360° Servos

Script for the Tilt & Grip cyber:bot with F360 Servos

This is the script to run on the cyber:bot robot. It receives values from the micro:bit tilt controller that are used for its Feedback 360 drive servos and Gripper servo.

  • Right-click the radio_tilt_grip_controlled_cyberbot_with_fb360.hex link below, chose Save As, and then save the file to your computer.

radio_tilt_grip_controlled_cyberbot_with_fb360.hex

  • Open the saved file with the micro:bit Python Editor editor.
  • If you are in a class with multiple tilt controlled cyber:bot robots, make sure to update channel=7 to your assigned value.

The .hex file download was created by entering the Python script below into the python.microbit.org editor, and also adding the cyberbot.py and Feedback360.py modules  to the Project File as shown in Add Modules to your micro:bit.  The Script Name was set to radio_tilt_grip_controller_with_fb360 before saving it as a .hex file as shown in Save & Edit Scripts.

  • Plug the battery pack’s barrel plug into the cyber:bot board’s barrel jack.
  • Set the cyber:bot board’s PWR switch to 0.
  • Click Send to micro:bit.
  • Disconnect the USB from the cyber:bot robot’s micro:bit module.

We’ll leave this for a while to set up the tilt controller

Project Script:radio_tilt_grip_controlled_cyberbot_with_fb360

# radio_tilt_grip_controlled_cyberbot_with_fb360

from cyberbot import *
from feedback360 import *
import radio

drive.connect()

radio.on()
radio.config(channel=7, queue=1, length=64)

while True:

    packet = radio.receive()

    if packet:

        try:

            dictionary = eval(packet)
    
            x = dictionary.get('x')
            y = dictionary.get('y')
            needle = dictionary.get('needle')
            
            fb = y / 10
            lr = x / 10

            button = dictionary['button']   # added
             
        except Exception as e:

            display.show(Image.SAD)
            print("Exception e:", e)
            print("Type:", type(e))
            continue

        else:

            if abs(y) > 80:
                display.show(Image.ALL_CLOCKS[needle])
                vL = fb
                vR = -fb

                if(fb < 0): lr = -lr
                vL = vL - lr/2              # Reduced lr term by 2
                vR = vR - lr/2              # Reduced lr term by 2

            else:

                display.show(Image.DIAMOND_SMALL)
                vL = 0
                vR = 0
            
            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

        finally:

            drive.speed(vL/2, -vR/2)  

 


Printer-friendly version
Adding Tilt Control
Prev
Script for the Tilt & Grip Controller with F360 Servos
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress