Leçon 1, Chapitre 1
En cours

Les capteurs – PIN State Monitor 2

Yann KIDSHAKER 18 mars 2026

Joystick

Now, let’s talk about another sensor: The Joystick. You must have either used it a lot while playing your favourite game or at least seen someone play with it; it has a stick that moves left, right, front, and back, and lets you control the position of the character you play in the game and a device that detects the position of the stick. It is, therefore, a position sensor.

Joysticks come in many shapes and sizes; what you have in your starter is a simple, sweet, and small version. It has a movable hat-like top, and 5 pins on its left: GND, +5V, VRX, VRY, SW. We know what GND and +5V stand for. VRX refers to the position in the X-direction, i.e. from left to right, and VRY refers to the position in the Y-direction, i.e. from front to back.

It also has two potentiometers; one in its front, and the other in its right. As you move the top of the joystick, you will be able to see the movement in the potentiometers as well. Let’s see what happens when we move the top.

Activity

Joystick_connection

  1. Take out 4 male-to-female jumper wires from the starter kit; connect the female ends of each wire to the GND, +5V, VRX, and VRY pins.
  2. Now, take the male end of the wire connected to the GND pin of the joystick and connect it to evive’s GND pin, on the top-left corner under the magic lid.
  3. Next, take the male end of the wire connected to the +5V pin of the joystick and connect to evive’s 5V pin, on the top-left corner, right above its GND pin.
  4. Now, take the free end of the wire connected to the VRX pin and connect it to evive’s A0 pin, right above the breadboard.
  5. Then, to evive’s A1 pin connect the male end of the remaining free wire, that is connected to the VRY pin.
  6. Once all you finish off with all the connections, go to evive’s controls menu and open Pin State Monitor.
  7. Then, select Analog Pins State. You’ll the same screen that you saw while working with the LDR. When you move the joystick from left to right you see that the value besides 0 changes from 0 to 1023; and when you move it from front to its back, the value besides 1 will change from 0 to 1023.

JoystickLogic

That’s how you can see what’s happening in a joystick, folks!

IR Sensor

Finally, coming to the third sensor, which, unlike the previous two sensors, is a digital sensor. The sensor we’re going to visualize next is an IR Sensor.

IR sensor

An IR Sensor or an infrared sensor senses whether there is an object near it or not. If it detects an object, the sensor will be ON; if not, it will remain OFF. We’ll learn about this sensor in detail in a different course that will be all about robotics. If you wish to learn about them and other cool stuff, don’t forget to join us there!

Activity

For now, let’s visualize how it works.

  1. Take out the IR sensor and 3 male-to-female jumper wires from the starter kit. On the sensor you’ll see two LEDs – one black, and one white/transparent, a potentiometer, a tiny signal LED, a tiny power LED, and finally 3 pins at the back; they are OUT, GND, and VCC.
  2. Take the 3 jumper wires and connect their female ends to the 3 pins on the IR sensor.
  3. Now, take the free end of the wire connected to the VCC pin and connect it to… you know where: evive’s 5V pin on the top left corner! Similarly, take the free end of the wire connected to the GND pin of the sensor and connect it to the evive’s GND pin, just below the 5V pin.
  4. Next, take the free end of the remaining wire and connect it to pin number 2, right below the breadboard.

Done with the connections! Time to the sensor in action!

  1. Switch ON your evive and select Pin State Monitor from the controls menu.
  2. From the 3 options that appear, select the Digital Pin States.
  3. Now, take your hand close to the IR sensor; when you do so, you’ll see that the LEDs light up, and on the screen, the state of pin 2 becomes ‘1’. As soon as you take your hand sufficiently far away from the sensor, the LEDs turn OFF, and the state goes back to being ‘0’.

That’s all folks! We’ve successfully seen an LDR, a Joystick, and an IR sensor in action with the help of evive’s Pin State Monitor.