Using the Electromagnet in VEXcode VR

This Electromagnet on the VEX VR Robot can be controlled to pick up and drop disks with metal cores.


What is an Electromagnet?

Screenshot of VEXcode VR interface showcasing robot features, including block-based and text-based coding options for programming a virtual robot, designed to enhance learning in STEM education.

An electromagnet is a specific type of magnet where the magnetic field is produced by an electric current. The VEX VR Robot has an electromagnet to pick up and put down disks that contain metal cores.

Diagram illustrating the features of the VEXcode VR robot, highlighting its components and capabilities within the online programming environment designed for learning coding concepts and robotics principles.

The VEX VR Robot Electromagnet is located at the front of the robot pointing down towards the Playground currently in use.


How Electromagnets Work

VEXcode VR Blocks

Diagram illustrating the features of VEXcode VR robots, highlighting components such as sensors, motors, and connectivity options, designed to enhance learning in coding and robotics for students and educators.

VEXcode VR Python

def main():
magnet.energize(BOOST)

On specific Playgrounds in VEXcode VR, there are disks with metal cores that can be used with the Electromagnet.

By setting the Electromagnet to 'boost,' the user is able to energize the magnet.

Illustration of VEXcode VR robot features, showcasing the virtual robot's design and capabilities in a coding environment, highlighting its educational applications in STEM learning and programming for beginners and advanced users.

Any disks beneath the Electromagnet will be picked up by the VR Robot.

VEXcode VR Blocks

Illustration of VEXcode VR robot features, showcasing the virtual robot's design and capabilities within the online programming environment, highlighting its educational applications in coding and robotics.

VEXcode VR Python 

def main():
magnet.energize(DROP)

By setting the Electromagnet to 'drop,' the user de-energizes the magnet.

Diagram showcasing the features of the VEXcode VR robot, highlighting its components and capabilities in a virtual programming environment for STEM education.

Any disk currently being held by the VR Robot Electromagnet will be dropped.


Uses in VEXcode VR

VEXcode VR Blocks Disk Transport Playground
Diagram illustrating the features of the VEXcode VR robot, showcasing its design, sensors, and capabilities within an online programming environment for learning coding concepts. Image illustrating the features of VEXcode VR robot, showcasing its virtual programming environment designed for learning coding concepts through a simulated robot, suitable for both beginners and advanced users in STEM education.
VEXcode VR Python
def main():
drivetrain.drive_for(FORWARD, 700, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
magnet.energize(BOOST)
drivetrain.drive_for(FORWARD, 300, MM)
wait(2, SECONDS)
magnet.energize(DROP)

The VEXcode VR Robot Electromagnet can be used on the Disk Transport Playground. Disks of varying colors lie within a walled area. The following example has the VR Robot drive forward into the Castle walls, turn left, then pick up and drop a blue disk.

Diagram illustrating the features of the VEXcode VR robot, highlighting components such as sensors, motors, and connectivity options, designed to enhance coding and robotics education for students and educators.

For an extra challenge, attempt to stack disks on top of one another. While the Electromagnet can only hold one disk at a time, the user is able to stack disks two high and still travel over the stack.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: