How to Control evive’s Touch Sensors in PictoBlox

controlling evive's touch sensors
About This Tutorial
This tutorial discusses what are capacitive touch sensors, evive’s capacitive touch input, and how to control the touch sensors in evive, with the help of a simple program in Stage mode.
Tutorial Info

Components Required

ImageComponentQuantityAvailable in Kit
evive1
USB A-B Cable1
Male to Male Jumper Cable 20cm2

Introduction

Touch sensors, as the name suggests, sense, or detect a touch, i.e. a physical contact made by something, typically a human. Unlike a button or switch, touch sensors are more sensitive, and are often able to respond differently to different kinds of touch, such as tapping, and swiping.

Working Principle

A touch sensor works in a way similar to a tactile (momentary) switch. When someone or something touches the sensor, there is a contact between the touch surface and the lower surface of the sensor and the circuit is complete. As a result current flows through the circuit. When there is no contact between the two surfaces the circuit is open and no current flows.

Capacitive Touch Sensor

Capacitive touch sensors are one of the most commonly used type of touch sensors. They are widely used in portable electronic devices such as Smartphones and MP3 players. The capacitive touch sensors are designed keeping in mind the fact that human beings have a certain amount of free charge. The sensor, when not touched has a certain amount of charge that is the reference. Whenever you touch the surface of the sensor, the amount of charge at the surface goes beyond the set reference and the sensor is activated.

evive has 12 touch inputs, which are interfaced via the MPR121 chip using SPI interface.

evive Capacitive Touch Pins

How to Control evive’s Capacitive Touch Sensor in PictoBlox

You can control evive’s capacitive touch input with the help of the following block:

  1. True: If the someone or something is touching specified channel
  2. False: If the no one or nothing is touching the channel

      You can find this block in the evive palette.

Activity: Making Tobi Move Using Touch Sensor

In this activity, we’re going to control Tobi’s appearance with the help of evive’s touch sensor. Take two male-to-male jumper wires. Connect one end of the first wire to Capacitive touch input pin 1. This pin has 1 written beside it. Connect the second wire to Capacitive touch input pin 2. It is right below Capacitive touch input pin 1.

When you touch the end of the wire connected to pin 1, Tobi will appear and start moving. When you touch the end of the other, he will disappear.

evive Notes Icon
When working with evive on PictoBlox for the very first time, or if you’ve previously uploaded another code to evive, you must upload the firmware in order to upload new code to it. You can find the procedure for the same HERE.

Follow the steps below to write the script:

 
  1. Connect evive to your computer and open PictoBlox; if already open and working on a project, save that project. Then, click on New.
  2. Go to the toolbar and click on the Board menu. Then select evive as your board. Pictoblox Board Selection
  3. Next, click on the Connect menu and from the fly-out menu, select the Port to which evive is connected e.g. COMXX or ttyXX.Once you select the port, the icon beside the Connect tab will become connected.Connect-Disconnect Icon
  4. Click on the Choose a Backdrop button. Then, select any backdrop of your choice from the backdrop library.Choose Backdrop
  5. Go to the Events palette and drag and drop the when flag clicked block.
  6. Next, go to the Looks palette and drag and drop the hide block.
  7. Go to the Motion palette and drag and drop the go to x: () y: () block below the hide block; set the x and y coordinates as and –50 respectively.
  8. Then, go to the Control palette and drag and drop the forever block.
  9. Drag and drop the if-else block below the forever block.
  10. Go to the evive palette and drag and drop the channel () touched block inside the diamond-shaped space of the if-else block; channel 1 is set as default.channel touched
  11. Next, go to the Looks palette and drag and drop the show block below the if arm of the if-else block.
  12. Below the show block, drag and drop the switch costume to () block from the Looks palette and select Tobi walking 1 from the drop-down menu.changing costume
  13. Then, go to the Control palette and drag and drop the wait () seconds block below the switch costume to () block. Write 0.1 in the space.
  14. Go back to the Looks palette and drag and drop the next costume block below the wait () secs block.
  15. Repeat steps 14 and 15 two more times.
  16. Repeat step 14.
  17. Go to the Control palette and drag and drop the if block below the else arm of the first if-else block.
  18. Go to the Robots palette and drag and drop the channel () touched block from the evive Inbuilt Tools extension inside the diamond-shaped space of the second if block; select 2 from the drop-down menu.
  19. Next, go to the Looks palette and drag and drop the hide block.

Below is the complete script:

 Controlling evive's touch sensors

Click on the green flag on the top right corner of the stage to run the script.

Click on the red octagon, next to the green flag to stop the script.

controlling evive's touch sensors

Conclusion

It this tutorial, you learned how to control evive’s touch sensors in PictoBlox.

Hope you had fun! 🙂

Share this Tutorial
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Related Projects & Tutorials
All articles loaded
No more articles to load
Featured Projects
All articles loaded
No more articles to load

Leave a Reply

Close Menu
×

Cart

Registrations for Codeavour 2019 are OPEN!
Participate in this unique coding contest and stand a chance to win exciting prizes!
x