Using the Electromagnet#

Using the Electromagnet

This tutorial walks you through using the Electromagnet to pick up and drop a Disk in VEXcode GO. By the end, you’ll have a project that picks up a Disk, waits, then drops it.

  1. Make sure your robot has an Electromagnet connected. See Configuring Devices if you haven’t added one yet.

  2. Attach an energize magnet block, set to boost, below the when started block, to pick up a Disk.

Pick up a Disk.#
cuando inicie :: hat events
energizar [Magnet2 v] a [impulso v]
  1. Attach a wait block, to give your robot time to react before dropping the Disk.

Wait before dropping the Disk.#
cuando inicie :: hat events
energizar [Magnet2 v] a [impulso v]
esperar [1] segundos
  1. Attach another energize magnet block below the wait block.

A second energize magnet block, below wait.#
cuando inicie :: hat events
energizar [Magnet2 v] a [impulso v]
esperar [1] segundos
energizar [Magnet2 v] a [impulso v]
  1. Change the parameter to drop, to release the Disk.

Screenshot of the finished project, with the second energize magnet block's dropdown open, showing boost and drop options, and drop selected.
  1. Attach a drive for block below the second energize magnet block.

The drive for block, below the second energize magnet block.#
cuando inicie :: hat events
energizar [Magnet2 v] a [impulso v]
esperar [1] segundos
energizar [Magnet2 v] a [soltar v]
conducir [adelante v] por (100) [mm v] ▶
  1. Change the direction parameter to reverse, to back away from the Disk once it’s dropped.

Screenshot of the finished project, with the drive for block's direction dropdown open, showing forward and reverse options, and reverse selected.
  1. Make sure your robot is connected to VEXcode. See Connecting to Your Robot if it isn’t connected yet.

Screenshot of the VEXcode GO toolbar, showing the Connect button in a Connected state.
  1. Select Start to run the project. The Electromagnet will pick up a Disk, wait a second, drop it, then back away.

Screenshot of the VEXcode GO toolbar, with the Start button highlighted.