Interfacing evive with PictoBlox

evive Brain
About This Tutorial
This tutorial discusses how to interface evive with PictoBlox, the evive palette, the two modes for writing scripts in PictoBlox, and how to upload a script to evive.
Tutorial Info

Components Required

ImageComponentQuantityAvailable in Kit
evive1
USB A-B Cable1

Introduction

You can write scripts in PictoBlox for numerous projects that can be carried out using evive. This tutorial will discuss how to interface evive with PictoBlox, the two modes for writing scripts, and how to upload the script to evive.

Interfacing evive with PictoBlox

To run the scripts written in PictoBlox on evive, you must upload it to evive. Follow the procedure below to connect interface evive with PictoBlox:

  1. Connect evive to your computer and open PictoBlox. If not yet installed, please refer to the Getting Started with PictoBlox tutorial HERE.
  2. In PictoBlox, go to the toolbar and click on the Board menu. Select evivePictoblox Board SelectionIn doing so, the evive, Actuators, Sensors, and Display extensions will automatically appear in the Block palette. If not, add them from the extension library by clicking on the purple-colored Add Extension button in the bottom-left corner of the window.
  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

Extensions for Controlling evive

PictoBlox has the following extensions that contain special blocks using which you can control evive:

  • evive extension: The blocks in this extension allow you to control the inbuilt functionalities of evive such as the tactile switches, slide switches, potentiometer, motors, 5-way navigation key, touch inputs and Real Time Clock.
  • Dabble extension: This extension has all the blocks that enable evive to communicate with Dabble
  • Actuators extension: The blocks in this extension enable you to control the actuators such as DC motors and servos connected to evive.
  • Sensors extensionThis extension allows you to control sensors connected to evive.
  • evive Display extensionThis extension allows you to control the display on evive screen (change color, font size, and font color), draw shapes, write text, and display values on the screen.
  • IoT extensionThe blocks in this extension allow you to make IoT-based projects such as home automation, monitoring temperature, etc.
  • Lighting extensionThis extension enables you to manipulate colors of an RGB LED strip.
  • Communication extensionThe blocks in this extension allow serial communication.

Modes of Working

There are two modes in PictoBlox using which you can work on evive:

  1. Stage Mode
  2. Upload Mode

Stage Mode

In this mode, you can write scripts for the sprite and board and control it in real time. If you disconnect the board, you cannot control it anymore.

PictoBlox Stage Mode

The Stage mode is the default working mode in PictoBlox.

Upload Mode

This mode allows you to write scripts and upload them to your board so that you can control even when it is not connected to your PC/laptop. You can upload the code to evive using this mode only.

To switch to the Upload mode, click on the toggle switch right above the stage. 

On doing so, the screen shown below will appear.

PictoBlox Upload Mode

In the Upload mode, there are three buttons replace the green flag and red octagon from the Stage mode. The second button is for upload the code to evive.

Upload Code Button

Activity: Controlling evive’s LED

Stage Mode

In this activity, we will write a script to the LED connected to evive’s pin 13 such that whenever you press the space bar on your keyboard, it turns ON. When you press the space bar, pin 13 becomes HIGH; therefore, the LED lights up. When you don’t press it, the pin returns to its initial state, i.e. LOW, and the LED turns OFF.

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.

To upload the firmware to evive, click on the Upload Firmware button as shown in the figure.

Follow the steps below to write the script. Make sure that the Stage mode is selected.

  1. Drag and drop the when flag clicked block from the Events palette in the scripting area.
  2. Go to the Control palette and drag and drop the forever block below the when flag clicked block to continuously check whether the spacebar is pressed or not.
  3. There are two possibilities: if the space bar is pressed, the LED must turn ON; else, it must remain OFF. To check this, there is a block in the Control palette called the if-else block. Drag and drop it inside the forever block.
  4. Go to the Sensing palette and drag and drop the key () pressed? block inside the diamond-shaped space of the if-else block. The space key is the default key. It will sense the above-mentioned condition.Space Key
  5. The pin 13 LED is connected to digital pin 13 on evive. To turn it ON, this pin must be set to HIGH. For that, go to the evive palette and drag and drop the set digital pin () output as () block below the if arm of the if-else block. Set the pin as 13 and output as HIGH.
  6. Similarly, drag and drop another set digital pin () output as () block below the else arm and set the output as LOW to turn the LED OFF.

Below is the complete script:

Controlling LED with space key

To run the script, click on the green flag in the top right corner of the stage. It will start glowing as soon as you click on the flag.

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

Upload Mode

In this example we will write a script to turn ON the LED connected to evive’s pin 13 whenever you press evive’s tactile switch 1. When you press the switch, pin 13 becomes HIGH; therefore, the LED lights up. When you don’t press it, the pin returns to its initial state, i.e. LOW, and the LED turns OFF.

Follow the steps below to write the script:

  1. Connect evive to your laptop/PC, and select the appropriate port.
  2. Save the previous script; then click on New.
  3. Go to the evive palette and drag and drop the when evive starts up block in the scripting area.
  4. Next, drag and drop the forever block from the Control palette below the when evive starts up block.
  5. Then, from the same palette, drag and drop the if-else block inside the forever block.
  6. Next, go to the evive palette and drag and drop the tactile switch () pressed? block inside the diamond shaped space in the if arm of the if-else block; the default switch selected is switch 1.
  7. Go to the evive palette and drag and drop the set digital pin () output as () block below the if arm of the if-else block. Set the pin as 13 and output as HIGH.
  8. Similarly, drag and drop another set digital pin () output as () block below the else arm and set the output as LOW to turn the LED OFF.
  9. Switch to Upload mode and upload the script to evive.

Below is the complete script:

Control-evive-LED-Upload-Mode_1

Conclusion

In this tutorial, you learned how to interface evive with PictoBlox and its two modes of working. You also wrote two scripts: the first to control evive’s pin 13 LED using a keyboard and the second to control it using evive’s tactile switch by writing and uploading the script to it.

Hope you had fun! 🙂

This helped
This didn't help
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
Featured Projects
Arcade-Basketball-Game
DIY Arcade Basketball Game
Introduction“We don’t stop playing because we grow old; we grow old because we stop playing.”…
All articles loaded
No more articles to load
Close Menu
×

Cart