EFBlock

From ElecFreaks
Jump to: navigation, search

Software Interface Description

Hello, welcome to the world of Arduino. Through the study of this tutorial, you can grasp how to use EFBlock to control your Arduino board and sensors as you master these basic but practical knowledge, you can DIY, use a variety of sensors and the Arduino boards to achieve various functions, don’t waste your creativity. Download EFBlock from: http://elecfreaks.com/estore/download/starterkit/EFBlock.zip Let's take a look at the software: The installation of the software is very simple, keep pressing “next”, and finally “finish”. Nothing needs to pay attention to . Open the software: This is our main interface. Simple configuration first: (at the beginning, the robot module is empty) Click on “Extension” in the menu bar and select “elecfreaks” (so the robot module isn’t empty now). Here we have finished the configuration. After configuration, let’s see what happen with the software interface.

Play Scratch with Arduino-EFBlock Catalog

  • 1. Software interface description
  • 2. Let's light up the world of Arduino
  • 3. How to light the led with a button?
  • 4. How to control a rotating fan
  • 5. How to light the induction fan
  • 6. Play with the corridor lights
  • 7. What’s the temperature today

1. Software interface description

  • Hello, welcome to the world of Arduino.
  • Through the study of this tutorial, you can grasp how to use EFBlock to control your Arduino board and sensors as you master these basic but practical knowledge, you can DIY, use a variety of sensors and the Arduino boards to achieve various functions, don’t waste your creativity.
  • Download EFBlock from:

http://elecfreaks.com/estore/download/starterkit/EFBlock.zip

  • Please install EFBlock.exe , and after installed and please check ‘EFBlock.bat ‘ which under install path ‘XXX\EFBlock\EFBlock.bat’
  • Let's take a look at the software:
  • The installation of the software is very simple, keep pressing “next”, and finally “finish”. Nothing needs to pay attention to .
  • Open the software:
EFB
  • This is our main interface.
  • Simple configuration first: (at the beginning, the robot module is empty)
  • Click on “Extension” in the menu bar and select “elecfreaks” (so the robot module isn’t empty now).
  • Here we have finished the configuration.
EFB

After configuration, let’s see what happen with the software interface?

  • 1.1 - Let's look at the menu bar first:
    • 1.1.1. Document
EFB


"New ": create a new project “Load Project”: open up the existing project "Save Project": save the current project to a local file (suffix.Sb2)

    • 1.1.2. "control panel menu and extended menu”: You can choose other boards here

(at the beginning, or when you find the robot module is empty, check whether the state of control panel is “Freaduino_uno” and the state of extended menu is “Elecfreaks”)

EFB
EFB
    • 1.13. "language":switch language of the software
  • 1.2 Next we go for one important section: the script
EFB

The scripts are divided by colors.

EFB
: Blue scripts belong to the robot module.
EFB
: Yellow scripts belong to the control module.
EFB
: Orange scripts belong to the data & instructions module.
EFB
: Green scripts belong to the digital & logical operations module.
    • 1.2.1. Robot Module

The robot module is corresponding to our peripheral sensor, connect the sensor to the corresponding interface (IO) if you want to use the corresponding script blocks. Here is one illustration: We have 4 script blocks corresponding to 4 different functions:

EFB

This block is the head of your program, which must be used at the top.

EFB

This block is used for connecting.

EFB

This block represents as a numerical value.

EFB

This block is usually used to judge the condition: yes/no. Now let’s go for what the text stands for.

The first white circle (
EFB
)of most building blocks display the interface,which you may be puzzled about:

Interface is the needle on motherboard. We use wire to connect the sensor and fill in the number of corresponding interface in the first circle, then the building blocks can be used. Arduino has two types of interfaces: Analog and Digital, which are abbreviated as “A” and “D” on the board.So check the letter “A”( A_ for analog and _ for digital) before you connect the sensor(e.g. A0/0).

EFB
 : Analog
EFB
 : Digital
Such as
EFB
, with “A” ahead and “0” in the circle, we should connect the button to A0 side of the board. (The color of wire & interface must be matched .)

We will introduce other scripts later.

2. Let's light up the world of Arduino

  • In the last chapter, we introduce the software interface. In this chapter, let’s just have a try. Freaduino is one kind of Arduino motherboard.

We will start with a simple experiment: Light a lamp with flash on the Freaduino board.

  • First we need to configure your development environment: make the motherboard communicate with computer.
  • Operation steps:
  • 01. Connect Aruino motherboard to computer with USB wire.
  • 02. Open the Elecfreaks software, install the Arduino driver (skip this step if you can find the port).
EFB
.
  • 03. Select the corresponding COM port.
EFB
.
  • 04. The title will display “connected” after you click.
  • 05. If you can’t figure out which COM port belongs to Arduino ,just launch the "port" in the device management.
  • 06. Check whether the “elecfreaks” has been selected.
EFB
.
  • 07. Drag the corresponding module to the right as below.
EFB
.

You will get this:

EFB
.

The blue blocks belong to the robot module and the yellow blocks belong to the control module.

EFB
.
EFB
.

Note: Input 13 in the white circle in place of 5 in this robot module

EFB
.
EFB
.
  • 08. Right click the main program block and select “upload to arduino”.
  • 09. Then what do you find?

Here we finished our first project which is simple but important.

3. How to light the led with a button

Learning objectives: Control the LED lights by the button Required electronic module:

Freaduino motherboard x1

Led block x1

Button block x1


Appearance:

EFB
.


Knowledge points: Blocks Usage

EFB
.

Represent the Arduino program,which could be burnt into Arduino motherboard.

EFB
.

Repeat implementing the scripts.

EFB
.

“if<condition>then”:If condition establishes,implement the scripts, if else then skip.

EFB
.

Wait for 1 second, integers and decimal are both available.

EFB
.

Wait until button are pressed, blue blocks can be replaced with other hexagonal blocks.

EFB
.

Light the led connected with D5 port(HIGH refers on,LOW refers off)

Example:

EFB
.

Flow chart:

  • 01. Set up the program
  • 02. Repeat the flowing statements
  • 03. Judge the state of button
  • 04. Light on with pressed button
  • 05. Wait for the button and press
  • 06. Light off with pressed button

Just have a try.

Let's review the steps:

  • 01. Connect the motherboard to the computer, check the serial port
  • 02. Connec the LED to D5
  • 03. Connect the button to “A0” on the board.
  • 04. Right click the main program block and select “upload Arduino program”. 

4. How to control a rotating fan

Imagine that the fan rotates when you are close and stops when you leave - let’s build this system on elecfreaks now! Learning objectives: The induction of human body Required electronic module:

Freaduino motherboard x1


Mini fan x1



Appearance:

EFB
.


Knowledge points:

EFB
.

Represent the Arduino program,which could be burnt into Arduino motherboard.

EFB
.

Repeat implementing the scripts.

EFB
.

“if<condition>then”:If condition establishes,implement the scripts,if else then skip.

EFB
.

Return true when situation meets the condition ,or return false.

EFB
.

Wait for 5 seconds.

EFB
.

Set the speed of fan(0 represents off work).

Integrated system:

EFB
.

Flow chart: 01. Set up the program. 02. Repeat the flowing statements. 03. Judge the exist of human body. 04. Fan works when human gets close to(speed as set before),lasts for 5 seconds. 05. Fan stops when human leaves.

Just a few lines will you build the system with induction function, easier than what you have thought about right? Here is what Arduino does, simplifying the complicated. Then connect PIR to A0 and the fan to D6, input the program, you will finish it. Expand:

  • 01. What if the fan could automatically adjust its speed according to the current temperature?

How to achieve? Think about it.

(Remind:
EFB
)

5. How to light the induction fan

We have learned two small systems, which will help you be familiar with the software interface and operating procedures.

Now let’s turn to a new block type:
EFB


  • Blocks *Usage *Examples
EFB
.

*Operations: plus, minus, multiply, divide.

  • Minus: * ;
  • Divide: / ;
  • Numbers and variables are available.
EFB
.
EFB
.
EFB
.
*Value comparison.
  • Numbers and variables are available.
    EFB
EFB
.

*Random number.

  • Numbers and variables are available.
EFB
.

* “and”:True with both conditions.

  • “or”:True with either condition.
  • “not” :False with the condition.
    EFB

If button A is not pressed,the result is true.

We will build a light induction fan after you have finished the knowledge above. Required electronic module:

  • Light sensor x1
  • Freaduino motherboard x1
  • Mini fan x1
EFB
.


Knowledge points:

  • Blocks *Usage
EFB
.

*Get the intensity of light (Recognize darkness around, value under 10 represents dark while the highest is 512.)

EFB
.

*Set the speed of fan(0 represents off work).

So you will find that the highest value of light intensity can be up to 512 while the highest rotation speed is 255.

EFB
.

How to solve this problem?

  • Divide the intensity of light by 2 with this building block
    EFB
    that we just learned.
  • So here we go:
EFB
.

Applying various operators flexibly and you will solve lots of problems smoothly. Remember the human body induction fan with adjust to temperature we mentioned in the last chapter?Then how can we improve the system with this block? Answer: Of course.For example, we can set the system into the case that fan begin to run only if the temperature is higher than a certain value.  

6. Play with the corridor lights

  • Think of such situation: The lights turn on when people pass by and turn off when we leave.
  • Now we will learn how to build this system which is common and simple in our daily life.
  • Before that you have 10 minutes to think about it yourself first.(You have access to the former learning materials.)


  • So it is believed that some guys have finished while it may be a little bit difficult to build a developed system in just 10 minutes.
EFB
.
  • The following reference map may be helpful:

Here are three conditions:

  • 01. To judge the current light intensity.
  • 02. To judge whether there comes a person.
  • 03. To judge whether the switch is on(for maintenance and safety).

Required electronic modules :

  • Light sensor x1
  • Human body sensor x1



  • Freaduino motherboard x1
  • Led x1


  • Button (without bounce is better) x1
    EFB
EFB
.
EFB
.
EFB
.
  • Basically the process is about meeting all the conditions or not.
  • Connect the light sensor to A0, the human body sensor to A1 and the button to A2. 

7. What’s the temperature today

  • By now you could find that connecting each single function by logic can you get a variety of systems with different functions.
  • So after the basic knowledge of sensor,it’s your turn to create how they could be used.
  • Here we go for another important building block:
    EFB
    , which could help us prevent repetitive work.
  • First we create a variable:
EFB
.

Click “Make a Variable”:

EFB
.

Input the name of your new variable and click “OK”.

EFB
.

Now we built a new variable.

instruction examples

  • “Variable” is a container of data storage, whose value depends on demand.
EFB
.
  • Save data of sensor into “variable”.
EFB
.

Plus 1 to the value of variable, negative is also available.


  • We are going to build a system displaying the temperature.
  • Required electronic module:

Freaduino motherboard x1

Temperature and humidity sensor x1

0.36 inch digital tube (small) x1
EFB
  • Knowledge points:

Blocks Usage

EFB
.

Read the value of temperature and humidity of the related sensor (DTH11).

EFB
.

Display of digital tube; Numbers and variables are available filled in the blank. (Connect CLK to A4 and DIO to A5).

  System implementation:

EFB
.
  • Flow chart:
  • 01. Start the program.
  • 02. Repeat the following statement.
  • 03. Store the humidity value of T&H sensor into the “humidity” variable.
  • 04. Store the temperature value of T&H sensor into the “temperature” variable.
  • 05. Display the “humidity"variable via digital tube
  • 06. Wait for one second.
  • 07. Display the “temperature"variable via digital tube
  • 08. Wait for one second.
  • So we finished it and the function mentioned before to adjust the rotating speed by temperature are waiting for you.

Here is one reference:

EFB
.

Now I believe you have some knowledge about this system, the next is up to you, think over and try a lot, don’t waste your creativity, do something awesome.