Monthly Archive:March 2019

Byamber

Graphical Programming Tutorial for Arduino – Eight of Flowing Water Light

Introduction

In this lesson we will realize the function of eight of flowing water light, from left to right, each only light one LED,reciprocating cycle.

Preparations

HARDWARE

  • Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
  • Breadboard x 1
  • LED x 8
  • 200 ohm resistor x 8
  • M/M jumper x 20
  • USB Cable x 1
  • PC x 1

Connection

You can wiring your hardware as below :

Why do I empty 0 and 1 and two interfaces? These two interfaces actually use as the board’s serial ports, TX and Rx, that is to say, if you connect led on these two interfaces, you can’t download the normal program. So, generally we will empty out, if must use the case, you need to download a good program first, and then connect the circuit.

Note:

You cannot directly connect an LED to a battery or voltage source. Firstly, because the LED has a positive and a negative lead and will not light if they are the wrong way around and secondly, an LED must be used with a resistor to limit or ‘choke’ the amount of current flowing through the LED – otherwise the LED could burn out!

Code Program

In this lesson, we will conduct a simple yet interesting experiment-using LEDS to create flowing LEDights. As the name suggests, these eight LEDS in a row successively light up and dim one afteranother, iust like flowing water.

If you have connected the wiring diagram, connect the Arduino Uno board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

Set pin 2-9 as LEDPINS, and set them as output respectively. Pin number ascends by 1(step)each time.

Light up the LEDS connected to pin 2-9 respectively, each lasting for 100ms.

Then, dim them from pin 9-2 respectively, also each lasting for 100ms.

Light them up from pin 9-2(reverse to the previous sequence)respectively for 100ms

Then dim them from pin 2-9 respectively for 100ms.

The whole code is as follows:

Click Save after all the programming is done . Select the board type and serial port before uploading。

Running Result

Now, you should see eight LEDS brighten one by one from the LED connected to pin 2 to that to9, and then dim in turn from the LED at pin 9 to the one at pin 2. After that, the LEDS will light up fromthe LED at pin 9 to that at pin 2 and dim from the LED at pin 2 to that at pin 9. This whole process wilepeat until the circuit is power off.

Byamber

Graphical Programming Tutorial for Arduino – Using a Button

Introduction

In this lesson, we will show how to turn on/off an LED by using an I/O port and a button. The “I/O port” refers to the INPUT and OUTPUT port. Here the INPUT port of the Osoyoo Uno board is used to read the output of an external device. Since the board itself has an LED (connected to Pin 13), so you can use this LED to do this experiment for convenience.

Preparations

HARDWARE

  • Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
  • Breadboard x 1
  • Switch Button x 1
  • 10k ohm resistor x 1
  • M/M jumpers
  • USB Cable x 1
  • PC x 1

About the button

Buttons are a common component used to control electronic devices. They are usually used as switches to connect or disconnect circuits. Although buttons come in a variety of sizes and shapes, the one used here is a 12mm medium-size button as shown in the following pictures.

The little button that are used in this lesson have four connections, which can be a little confusing.

Actually, there are only really two electrical connections, as inside the switch package pins B and C are connected together, as are A and D.

Connection

Although the bodies of the switches are square, the pins protrude from opposite sides of the switch. This means that the pins will only be far enough apart when they are the correct way around on the breadboard.Build the circuit as below:

Notice:

Generally, the button is directly connected in an LED circuit in order to turn on or off the LED. This connection is relatively simple. However, sometimes the LED will light up automatically without pressing the button, which is caused by various interferences. In order to avoid these external interferences, a pull-down resistor is used, that is, to connect a 1K–10KΩ resistor between the button port and GND. It is used to consume external interferences while connected to GND for as long as the button switch is turned off.

Code Program

After above operations are completed, connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

We have learnt how to make an LED blink in last lesson. So in this one we will add a button to controlthe LED on/off.First, we need to declare a variable to show the Buttons state. Drag out a Declare block in Variablescat.

Name this variable to Buttonstate, and select the type to int.

To assign 0 to Buttonstate initially, drag out the first block in Math, and add it behind the Buttonstate. The number in the slot can be changed, here we set it as 0.

Click Variables again, and you can see there are the corresponding input and output blocks whichcan be used in later part.

To read the state of buttonstate, drat an input block in Variables

Drag out a digital Read block in the In/Out category and add it behind the buttonstate(input), toead the pin’s state value and assign it to buttonstate Here the button is connectedwere reading the state of pin 12, meaning using the variable buttonstate to represent the pins state.

Add an if do block in Control under button State. If a value is true. thent block of thestatement. Otherwise. run the second block.

If we need an else sub-block, just click the setting icon beside if:

Drag the else into the right if block, you can see it become if_do_else block,

Click the icon again to fold the pop-up

Next, we should add the condition of if, that is buttonstate==High- find the block in Logic.

Drag out the Buttonstate(output) in Variables, and drop it to the first slot.

Drag out the first block in In/Out, and placele second slot. Now, the if statement is completed.

If the condition is met, set the LED at pin 13 to high, namely to light up the LED.

Otherwise, set pin 13 to low level.

The whole program is as above. You can check the code on the right bar.

Click Save after all the programming is done. Select the board type and serial port before uploading.

Finally, the staus will change to ‘Upload success!’.

Runnig Result

Now, press the button, and the LED on the OSOYOO Uno board will light up. When the switch is released, the LED goes out.

The Expansion Example

Here’s a simpler way to program: Complete the connection according to the above operation, , set the corresponding board type and port type in the software, then upload the following code.

A few seconds after the upload finishes,when the button switch is pressed, LED light up; when the switch is released, the LED goes out.

Scientists, one of the most valuable quality is always maintained in this world childlike curiosity, to explore the vision, constantly pioneering and enterprising city

Byamber

Graphical Programming Tutorial for Arduino – Control an LED

Introduction

In this lesson, we will show how to control an LED by using the OSOYOO UNO board. We’ll use graphical programming in this tutorial. If you’re not familiar with it, you can learn about the previous tutorials first.

Preparations

HARDWARE

  • Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
  • Breadboard x 1
  • LED x 1
  • 200 ohm resistor x 1
  • 1k ohm resistor x 1
  • 10k ohm resistor x 1
  • M/M jumper x 2
  • USB Cable x 1
  • PC x 1

Component Introduction

BREADBOARD

A breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes let you easily insert electronic components to prototype (meaning to build and test an early version of) an electronic circuit, like this one with a battery, switch, resistor, and an LED (light-emitting diode).

The connections are not permanent, so it is easy to remove a component if you make a mistake, or just start over and do a new project. This makes breadboards great for beginners who are new to electronics. You can use breadboards to make all sorts of fun electronics projects.

Remember that the inside of the breadboard is made up of sets of five metal clips. This means that each set of five holes forming a half-row (columns A–E or columns F–J) is electrically connected. For example, that means hole A1 is electrically connected to holes B1, C1, D1, and E1. It is not connected to hole A2, because that hole is in a different row, with a separate set of metal clips. It is also not connected to holes F1, G1, H1, I1, or J1, because they are on the other “half” of the breadboard—the clips are not connected across the gap in the middle (to learn about the gap in the middle of the breadboard, see the Advanced section). Unlike all the main breadboard rows, which are connected in sets of five holes, the buses typically run the entire length of the breadboard (but there are some exceptions). This image shows which holes are electrically connected in a typical half-sized breadboard, highlighted in yellow lines.

Buses on opposite sides of the breadboard are not connected to each other. Typically, to make power and ground available on both sides of the breadboard, you would connect the buses with jumper wires, like this. Make sure to connect positive to positive and negative to negative (see the section on buses if you need a reminder about which color is which).If you want to get more info about the breadboard,please check this link.

Notice:

When you start to put components on your breadboard, avoid adding, removing, or changing components on a breadboard whenever the board is powered. You risk shocking yourself and damaging your components.

LED

LEDs (that’s “ell-ee-dees”) are a particular type of diode that convert electrical energy into light. In fact, LED stands for “Light Emitting Diode.” (It does what it says on the tin!) And this is reflected in the similarity between the diode and LED schematic symbols:

In short, LEDs are like tiny lightbulbs. However, LEDs require a lot less power to light up by comparison. They’re also more energy efficient, so they don’t tend to get hot like conventional lightbulbs do (unless you’re really pumping power into them). This makes them ideal for mobile devices and other low-power applications.

LEDs have a positive side (called the anode) and a negative side (called the cathode). The metal lead for the anode is longer than the lead for the cathode. The cathode side also usually has a flat edge on the plastic part of the LED.More info about the LED please check this link.

Notice:
You cannot directly connect an LED to a battery or voltage source. Firstly, because the LED has a positive and a negative lead and will not light if they are the wrong way around and secondly, an LED must be used with a resistor to limit or ‘choke’ the amount of current flowing through the LED – otherwise the LED could burn ou!

RESISTOR

Resistors are electronic components which have a specific, never-changing electrical resistance. The resistor’s resistance limits the flow of electrons through a circuit.

They are passive components, meaning they only consume power (and can’t generate it). Resistors are usually added to circuits where they complement active components like op-amps, microcontrollers, and other integrated circuits. Commonly resistors are used to limit current, divide voltages, and pull-up I/O lines.We are going to use this to control how much electricity flows through the LED and therefore how brightly it shines.

The electrical resistance of a resistor is measured in ohms. The symbol for an ohm is the greek capital-omega: Ω. The (somewhat roundabout) definition of 1Ω is the resistance between two points where 1 volt (1V) of applied potential energy will push 1 ampere (1A) of current.

In this lesson, we are going to use three different values of resistor, 200Ω, 1kΩ and 10kΩ. These resistors all look the same, except that they have different colored stripes on them. These stripes tell you the value of the resistor.

The resistor color code works like this, for resistors like this with three colored stripes and then a gold stripe at one end.

Unlike LEDs, resistors do not have a positive and negative lead. They can be connected either way around.More info about resistor please check this link.

Connection

Connect up your stripboard as shown below, using the 200Ω resistor.We attach the LED to an output pin(D2 here) of the Osoyoo Uno.

Code Program

Connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

This lesson is very similar to the last one, as long as the pin number is changed from 13 to 9.

This program will give a high or low level to the LED connected pin 9 to turn it on and off. After programming, you can click the “<" button to check the corresponding code on the right bar.

Click Save aftogramming is done. Select the board type and serial port before uploading. For instause a Uno board, just select Arduino/Genuino Uno: if you use a Mega2560, select Arduino/Genuino Mega or Mega2560.

Select the serial device of the Arduino board from the COM menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

Next,upload the code. If the uploading fails, check and correct the code according to the prompts

Finally, the staus will change to ‘Upload success!’.

Runnig Result

A few seconds after the upload finishes, you should see the pin 2 LED on the breadboard start to blink as below:

With the 200 Ω resistor in place, the LED is quite bright.

Now we swap out the 200 Ω resistor for the 1k Ω resistor, then the LED appear a little dimmer:

Finally, with the 10 kΩ resistor in place, the LED is quite faint:

Byamber

Graphical Programming Tutorial for Arduino – Hello World

Introduction

A “Hello, World!” program is traditionally used to introduce novice programmers to a programming language.

“Hello, world!” is also traditionally used in a sanity test to make sure that a computer language is correctly installed, and that the operator understands how to use it, so our Arduino graphical programming tutorial begins with Hello World.

This lesson will basically get you up and running using the Arduino Graphical Programming software and uploading the code to the Arduino board. Once you’ve completed this step we can continue to the really exciting stuff, which is when we start writing our own code!

Preparations

HARDWARE

  • Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
  • USB Cable x 1
  • PC x 1

Notice:

Not much is needed for this lesson,make sure you’ve gone through Preparation lessons first! These lessons assume you have installed Arduino IDE software and drivers!

Make sure you have a good quality syncing cable,do not pick a ‘charge only’ USB cable

Upload Sketch

Connect your Osoyoo UNO board to the Computer via a A to B USB cable,then double click the Mixly software icon on your desktop.

Choose the “SerialPort” block, find the Serial baudrate module,

Click it and drag it to the blank area, now we can see the default baudrate is 9600 Mhz,

Then, choose the Serial println module,

Drag the Serial println block under the Serial baudrate one and fit the bulge and slot at the two to combine,

Now, click the Text block and choose the “hello” text module,

Drag it to the position shown below and change the text to “Hello World!”

This program will print “Hello World!” on the serial port. After programming, you can click the “<" button to check the corresponding code on the right bar.

Click Save aftogramming is done. Select the board type and serial port before uploading. For instause a Uno board, just select Arduino/Genuino Uno: if you use a Mega2560, select Arduino/Genuino Mega or Mega2560.

Select the serial device of the Arduino board from the COM menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

Next,upload the code. If the uploading fails, check and correct the code according to the prompts

Finally, the staus will change to ‘Upload success!’.

Runnig Result

A few seconds after the upload finishes, you should see the TX LED on the board start to blink (in orange).Click the Serial Monitor button:

Make sure the serial monitor’s COM port is corresponding to your Arduino port, and check if the serial monitor Baudrate is same as your sketch setting? If yes,you will see the Arduino serial continuously output the string “Hello World”:

If you have successfully completed all the operations and procedures. Congratulations! You have graphically programmed Arduino to start and run.

Byamber

Graphical Programming Tutorial for Arduino – Blinking the On-board LED

Introduction

In this lesson, you will learn how program your Arduino to make the Arduino’s built-in LED blink.

Preparations

HARDWARE Preparation

  • Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
  • USB Cable x 1
  • PC x 1

Notice:

Not much is needed for this lesson,make sure you’ve gone through Preparation lessons and Hello World lesson first!

Make sure you have a good quality syncing cable,do not pick a ‘charge only’ USB cable

The ‘L’ LED

The Arduino has rows of connectors along both sides that are used to connect to electronic devices and plug-in ‘shields’ that allow the Arduino to do more.However, the Arduino also has a single LED that you can control from your sketches. This LED is built onto the Arduino board and is often referred to as the ‘L’ LED as this is how it is labelled on the board. By default, this led is connected to the D13 pin of the UNO board.

The position of this LED is circled in red on the pictures of the Arduino Uno and Leonardo below.

Connect the board

Connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

Code Program

Open the Mixly software and you will see:

In the “In/Out” menu, find the Digital Output module,

Click it and drag it to the blank,

Click to select 13 in the slot of PIN # and set the stat to HIGH,

Then, drag a Delay block in the Control category to the coding area,

As default, set the delay value to 1000ms.

Drag the Delay block under the Digital Write one and fit the bulge and slot at the two to combine,

Drag out another Digitalwrite inIn/Out, then set the pin to 13 and Stat to LOW, drag another Delay block or just right-click it to duplicate one, and set the value to 1000ms.

This program will give a high or low level to the LED connected pin 9 to turn it on and off, namelyinking. After programming, you can click the “<" button to check the corresponding code on the right bar.

Click Save aftogramming is done. Select the board type and serial port before uploading. For instause a Uno board, just select Arduino/Genuino Uno: if you use a Mega2560, select Arduino/Genuino Mega or Mega2560.

Select the serial device of the Arduino board from the COM menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

Next,upload the code. If the uploading fails, check and correct the code according to the prompts

Finally, the staus will change to ‘Upload success!’.

Runnig Result

If you have completed all the above steps, you will see the result as below:

Extended experiment

You are now going to make your LED blink faster.As you might have guessed, the key to this lies in changing the parameter in the blank for the ‘Delay’ block.

This delay period is in milliseconds, and so if you want the LED to blink twice as fast, change the value of 1000 to 500. This would then pause for half a second each delay rather than a whole second.Upload the code again and you should see the LED start to flash more quickly,you can see the program result as below :

Summary

Here, we see two very common modules – Digital Output and Delay.

Digital output is one of the control modes of the Arduino for the original parts. It transmits digital signals to the output circuit – 0 and 1. 0 means that the output level is low and the circuit will not be connected; 1 means that the output level is high and the circuit is connected.

In the above program, the digital output of pin 13 is set high, and the onboard LED lamp connected with pin 13 will be lit. After a one-second delay (in the process of delay, the hardware remains at the start of the delay until the end of the set time), the digital output changes.

For low, the lamp will go out, and then remain out for 1 second.

As you can see, the on-board LED lights re-turn on after 1 second of extinguishing, and then turn off after 1 second, so on and so on. This is because Mixly and Aduino default that the program is repeated. Without other interventions, the procedure will be repeated all the time.

And the lamp is always on for one second and off for one second, and the repetition will not change. This is because the modules of these programs are executed in the order in which they are arranged. The main board will not execute the first module first, then skip the delayed module, go directly to execute the third module, or execute in any order different from the program.

Byamber

Graphical Programming Tutorial for Arduino – An Introduction to Mixly

Introduction for Mixly

Mixly is a free open-source graphical Arduino programming software, based on Google’s Blockly graphical programming framework, and developed by Mixly Team@ BNU.
It is a free open-source graphical programming tool for creative electronic development; a complete support ecosystem for creative e-education; a stage for maker educators to realize their dreams.
Although there is an Ardublock graphical programming software launched by Arduino official, Ardublock is not perfect enough, and many common functions cannot be realized.

The figure below shows the functional comparison between Ardublock and Mixly.
Mixly- table.png
It can be said that Mixly is the most versatile and smoothest Arduino graphical programming software, which can replace the Arduino programming tool IDE.

Design Concept and User Groups

Design Concept

(1) Usability
Mixly is designed to be completely green. Currently Mixly supports win, ubuntu, mac. Windows users can download the Mixly package directly from the Internet, and unzip it to run on Windows XP and above (download link is attached below).

(2) Simplicity
Mixly uses the Blockly graphical programming engine to replace complex text manipulation with graphical building blocks, providing a good foundation for beginners to get started quickly.
 Use the different color icons to represent different types of functional blocks, very convenient for users to classify.
 Provide default options in the composite function block to effectively reduce the number of user drags.
 Integrate all the features of the software in the same interface.
 Provide the reference tutorial and code examples.

(3) Functionality
It has versatile functions. Mixly can almost implement all the functions that Arduino IDE has. Support all official development boards of arduino.

(4) Continuity
The goal of the graphical programming system is definitely not to replace the original text programming method, but to better understand the programming principles and program thinking through graphical programming, and lay the foundation for future text programming.
It is also the design philosophy for Mixly. More continuous content has been added to the design of the software to protect the user’s learning outcomes. To be specific, it includes the introduction of variable types, the consistency of text programming as much as possible in the design of the module, and the support of both graphical and text programming.

(5) Ecological
The most important design concept of Mixly is its ecological feature, which can distinguish it from other Arduino graphical programming.
In order to achieve sustainable development, Mixly is designed to allow manufacturers to develop their own unique modules (currently supports DfRobot, StartLab, MakeBlock, Sense, Seeed, Lubot. But users require JavaScript programming foundation to make this part of the module).
It also allows users directly use Mixly’s graphical programming function to generate common modules (such as LED digital display, buzzer broadcast, etc. Users are able to make this part of the module only using Mixly).
Both of the two kinds of modules mentioned above can be imported into the Mixly system through the “Import” function, thereby realizing the user’s own value in the popularity of Mixly software.

User Groups

From the above design concept, it can be seen that Mixly is suitable for primary and secondary school students to cultivate programming thinking. It is also available for quick programming when creating a work. Of course, it is good for those lovely friends who don’t want to learn text programming, but want to do some small works with intelligent control.

Mixly Interface Functions

System Functions

Look at the main interface of Mixly, it includes five parts, that is, Blocks selection, code edit, text code (hidden), system function and message prompt area. Shown below.
3.1-1.png
Some common functions:
Through this interface, you can complete the code compile、upload、save and manage. It support four remove methods: drag it left out code window, or drag to Recycle Bin, delete key, or right-click to delete block. It supports four languages: English、Español (Spanish)、中文简体(Chinese Simplified)、中文繁体(Chinese Traditional).
3.1-2.png

In/Out Block

3.2-1.png

No. BLOCK ICON DEFINITION
1 3.2-2.png Returns HIGH or LOW voltage
2 3.2-3.png Write digital value to a specific Port.
Digital Output: set the HIGH or LOW output for IO pins
3 3.2-4.png Returns a digital value of a specific Port.
Digital IO Read Pin, generally used to read the HIGH or LOW level detected by Digital sensor
4 3.2-5.png Write analog value between 2 and 255 to a specific Port.
Analog Output: set the Analog value output by Analog IO pins (0~255).
5 3.2-6.png Returns value between 0 and 1023 of a specific Port.
Analog IO Read Pin, generally used to read the Analog value detected by Analog sensor.
6 3.2-7.png External Interrupts function, with three trigger interrupt modes RISING, FALLING, CHANGE.
7 3.2-8.png Detachs interrupt to a specific Port.
Turn off the given interrupt function.
8 3.2-9.png Set the IO pins as Output or Input state
9 3.2-10.png Read the continuous time of HIGH or LOW pulse from IO pins.( generally used for ultrasonic ranging)
10 3.2-11.png Read a pulse (either HIGH or LOW) on a pin within a time set in timeout.
11 3.2-12.png Set the ShiftOut data pin, clock pin. Output the data needed from the bitOrder MSBFIRST or LSBFIRST (Most Significant Bit First, or, Least Significant Bit First).
Generally used for controlling the 74HC595 CHIP.
12 3.2-13.png This is the function interface under Normal mode. If select Advanced mode, the functions will be more.

For example:
Connect your Arduino Uno board, then follow the steps below to light the Pin13 led on Arduino UNO.
3.2 led D13.PNG

Control Block

Control.PNG

No. BLOCK ICON DEFINITION
1 3.3-1.png Initialization (run only once)
2 3.3-2.png End the program, means the program will stop running when use this block.
3 3.3-3.png Delay function, click to select ms or us
(pause the program for the amount of time (in milliseconds) specified as parameter. There are 1000 milliseconds in a second.)
4 3.3-4.png if_do function (first evaluate a value be true or false, if a value is true, then do some statement.
You can click the blue gear icon to select the else if block or else block.)
5 3.3-5.png switch function. You can click the blue gear icon to select the case block or default block. (used to evaluate several programs then execute the corresponding function matched with program.)
6 3.3-6.png Equal to for statement.
7 3.3-7.png A while loop statement.
8 3.3-8.png break function, used to exit from the containing loop.
9 3.3-9.png millis() function, returns the system running time since the program started.(The unit can be ms (milliseconds) or μs(microsecond)).
10 3.3-10.png Timer interrupt function, that is, set a trigger interrupt for the amount of time (in milliseconds) specified as parameter.
11 3.3-11.png Timer interrupt start block
12 3.3-12.png Timer interrupt stop block

For example:
Compile and upload the program below to your Arduino board, you should see Pin13 LED on Arduino UNO continue to flash.(with an interval of 1s, equal to 1000ms)
3.3 flash.PNG

Math Block

3.4.png

No. BLOCK ICON DEFINITION
1 3.4-1.png A number
2 3.4-2.png Click to select the Arithmetic Operators:
+(addition); -(subtraction); x (Multiplication); ÷(division); %(remainder); ^(bitwise xor)
3 3.4-3.png Click to select the & (bitwise end); l (bitwise or); << (bitshift left); >> (bitshift right)
4 3.4-4.png Click to select the sin; cos; tan; asin; acos; atan; ln; log10; e^; 10^; ++ (increment) ;— (decrement)
5 3.4-5.png Click to select the Round; Ceil; Floor; abs; sq; sqrt
Round: Returns the integer part a number using around.
Ceil: Returns the integer part a number using ceil.
Floor: Returns the integer part a number using floor.
abs: Return the absolute value of a number.
sq: Return the square of a number.
sqrt: Return the square root of a number.
6 3.4-6.png If select the max, returns the larger number;
if select the min, returns the smaller number.
7 3.4-7.png Initialize the random seed
8 3.4-8.png Return a random integer between the two specified limits, inclusive.
9 3.4-9.png Constrain a number to be between the specified limits (inclusive).
(generally used to constrain an analog value read from sensor)
10 3.4-10.png Map a number from the first interval to the second interval.
(For instance, potentiometer-controlled servo, map the range of potentiometer (0, 1023) to the angle of servo (0, 180)).

Text Block

3.5.png

No. BLOCK ICON DEFINITION
1 3.5-1.png character string: a letter, word, or line of text.
2 3.5-2.png A character
3 3.5-3.png Creates a piece of text by joining together two piece of text.
( Here Hello join Mixly equals HelloMixly)
4 3.5-4.png Converts a string into an integer or an float.
5 3.5-5.png Returns the char corresponding to an ASCII code
(Decimal number 97 corresponding to a)
6 3.5-6.png Returns the ASCII code corresponding to a char.
7 3.5-7.png Converts a number into a string.
8 3.5-8.png Calculates the length of a string
9 3.5-9.png Output the char of a string (the char at 0 of hello is h)
10 3.5-10.png The first string equals or startsWith or endsWith the second string, returns 1, otherwise returns 0.
(if equals, both strings are abc, returns 1.)
11 3.5-11.png Returns a decimal value of the first string subtracts the second string.

List Block

3.6.png

No. BLOCK ICON DEFINITION
1 3.6-1.png Create a list with any number of items
2 3.6-2.png Creats a list from a text. (int mylist [ ]={0,0,0};)
3 3.6-3.png Creats a list from a text. (int mylist [ ]={0,0,0};)
4 3.6-4.png Returns the value of at the specified position in a list.
5 3.6-5.png Sets the value of at the specified position in a list.
Set the first item in mylist to another item.

Logic Block

3.7.png

No. BLOCK ICON DEFINITION
1 3.7-1.png logic comparision
=: Return true if both inputs equal each other.
≠: Return true if both inputs are not equal to each other.
<: Return true if the first input is smaller than the second input.
≤ : Return true if the first input is smaller than or equal to the second input.
>: Return true if the first input is greater than the second input.
≥ : Return true if the first input is greater than or equal to the second input.
2 3.7-2.png and:Return true if both inputs are true;or: Return true if at least one of the inputs is true
3 3.7-3.png Returns true if the input is false. Returns false if the input is true.
4 3.7-4.png Returns either true or false.
5 3.7-5.png Returns null
6 3.7-6.png If the first number is true, the second number is returned, otherwise the third number.

Variable Block

3.8.png

No. BLOCK ICON DEFINITION
1 3.8-1.png Declare and initialize a variable.
Click to select int, long,float, boolean, byte,char, string
2 3.8-2.png Define the data types

For example: LED breath
You need an Arduino Uno and one LED module. Connect the control pin of LED module to Pin 3 of Uno board (or other pins with “~”,that is, those pins can output PWM signal). LED will gradually light then gradually dim, repeatedly.
3.8 LED breath.PNG

SerialPort Block

3.9.png

No. BLOCK ICON DEFINITION
1 3.9-1.png Set the serial buad rate to 9600
2 3.9-2.png Write the specified number, text or other value.
3 3.9-3.png Print the specified number, text or other value on monitor.
4 3.9-4.png Print the specified number, text or other value on newline of monitor.
5 3.9-5.png Print the specified number in hexademical format on newline of monitor.
6 3.9-6.png If the serial port is available, it returns true, otherwise returns false.
(generally used in Bluetooth communication)
7 3.9-7.png Returns a string in serial port
8 3.9-8.png A string read from serial port to a string variable, pause until read the specified character.
9 3.9-9.png Read the serial data by byte (generally used to read the value sent from Bluetooth) (delete the data has been read)
10 3.9-10.png Wait for the output data completed
11 3.9-11.png Set the software serial port
(call this function if need to use several serial ports)
12 3.9-12.png Event function trigger by serial port data, that is, serial port is ready to call this function.
(equal to an interrupt function)

For example: serial communication
Done uploading the code, open the Arduino monitor, then enter a “hello” on the top bar, and click Send, it will print out “hello,world”.
3.9 Serial port -1.PNG

3.9-13.png

Communicate Block

Communicate.PNG

No. BLOCK ICON DEFINITION
1 3.10-1.png Do something when receiving infrared signals.
3.10-1-1.png
2 3.10-2.png Sends infrared signals of the specified types.
IR transmitter sends the data, here use the libraries, only PIN3 port.
3 3.10-3.png Enable IR decoding
4 3.10-4.png Print the Infrared signal in RAW types when receiving it.
5 3.10-5.png Sends RAW infrared signals (set the pin number, list, length of list and IR frequency)

For example:
You need an Arduino Uno board, an IR receiver module and an IR remote control.
Connect the signal pin of IR receiver to Digital pin 3 of Uno board, then upload the code and open the monitor. If send a signal to an IR receiver module using an IR remote control, you should see the monitor show the corresponding signal data.
3.10 ir.PNG

Sensor Block

Sensor.PNG

No. BLOCK ICON DEFINITION
1 3.11-1.png Set the Trig and Echo pin of ultrasonic sensor.
Returns the distance of ultrasonic sensor measured. (unit: cm)
2 3.11-2.png Set the control pin of DHT11 temperature and humidity sensor.
Returns the temperature or humidity of DHT 11 sensor measured.
3 3.11-3.png Set the control pin of DHT11 temperature and humidity sensor.
Returns the temperature or humidity of DHT 11 sensor measured.

For example: ultrasonic ranging
Connect the Trig pin of ultrasonic sensor to Digital 1 of Uno, Echo pin to D2, then upload the code and open the monitor, you should see the distance value, updating once per 100ms.
3.11-4.png

Actuator Block

Actuator.PNG

No. BLOCK ICON DEFINITION
1 3.12-1.png Sets the servo pin;
Moves between 0-180 degree;
Delay time for servo to rotate.
2 3.12-2.png Returns that degree with the last servo move.
Read the degree of servo connected to IO pin set
3 3.12-3.png Set the pin and specified frequency for buzzer to play sound.
4 3.12-4.png Stop playing sound

For example:
Connect the signal end of servo to Digital 0 of Uno, then upload the code below, servo will rotate 90 degrees.
Note: Delay 100ms is the time required for servo to move.
3.12-5.png

Monitor Block

Monitor.PNG

No. BLOCK ICON DEFINITION
1 3.13-1.png Set the IIC LCD1602 address
2 3.13-2.png Input the value on LCD line 1 and line 2 from left to right.
3 3.13-3.png Set the row and column of LCD to print the char
4 3.13-4.png Clear the LCD screen
5 3.13-5.png Set the control pin and the number of RGB light.
6 3.13-6.png Set the RGB light pin, light number and brightness
7 3.13-7.png Set the control pin, light number and color. (click to select the color)
8 3.13-8.png Clear the data, namely turn off digital display
9 3.13-9.png Four-digit display, displaying abcd.
10 3.13-10.png Turn on or off the digitdisplay
(here turn on the first digitdisplay)

For example: serial communication
Separately connect the SDA (A4) and SCL (A5) of Arduino Uno to SDA and SCL pins of IIC LCD1602, then set the address of your LCD1602 screen, the LCD address we used here is 0x27. Then upload the code, LCD screen has two lines, you should see the line 1 print HELLO, and line 2 print 123456789.

3.13 LCD16002.PNG

Functions Block

Function.PNG

No. BLOCK ICON DEFINITION
1 3.14-1.png Creates a function with no output.
Click the blue icon to set the procedure parameter.(no return value)
2 3.14-2.png Creates a function with an output.
Click the blue icon to set the procedure parameter.
(with return value and can set the data types)
3 3.14-3.png If a value is true, then return a second value.

For example: ultrasonic ranging
Below is an example code for line tracking car. We use three tracking modules (left to D6, middle to D7, right to D8). of course you need a tracking car to test it. First edit the forward, backward, turn left, turn right and stop into functions block. Then compile and upload the code below.
图片1-mixly 3.14.png

3.14-4.png

More Resources

  • Download the Mixly software WIN:

https://drive.google.com/open?id=1oQxF-AZ0Aw6OQhu_8NSvwo3L2OP0Z6cU

  • Download the Mixly software MAC:

https://drive.google.com/open?id=16ZUx0oWmCHAB69_mCXWgcdMeGj4PeMgG

  • Download the Example Code:

https://drive.google.com/open?id=1Fjd3SHHkg_-0IdB6GPX2uuTv3aRGMCSd

  • Download the PDF:

https://drive.google.com/open?id=12qBAsvVvslAJyHK6Gku0nU3moUB7pYvZ

Byamber

A Brief Introduction of Graphical Programming for Arduino

What is it?

Programming is the process that makes it possible to create computer software, applications and websites. Currently, computers are unable to think for themselves; they require users to give them sets of ordered instructions to know what to do. This is referred to as ‘code’. Most of the resources you use on the computer and internet are made with code. Programming is a core element of the Digital Technologies curriculum because it helps students develop essential skills such as problem-solving, logic and critical thinking.

Graphical programming, also known as visual programming or block-based programming, is the coding language prescribed in the STEAM Curriculum: Digital Technologies for primary schools. This type of language allows users to create programs by manipulating elements graphically rather than writing them in text format.

Graphical Programming

A programming language or environment where a program is represented and manipulated graphically rather than as text. A common visual metaphor represents statements and control structures as graphic blocks that can be composed to form programs, allowing programming without having to deal with textual syntax. Examples of visual programming languages include: Alice, GameMaker, Kodu, Lego Mindstorms, MIT App Inventor, Scratch (Build Your Own Blocks and Snap).

If you are a visual learner, you may wonder how visual and the auditory information are translated into a language of the computers. The graphical approach in programming will allow the computer to process the spatial representations in two or more dimensions. This graphical programming is calledas Visual Programming Language in which it defines pictures by means of textbased language. It is frequently used in engineering system designs totranslate the information of events and vibrations during the testing of automotive engines into a visual readout.

Graphical programming tools are used to employ the block diagrams, virtual instrumentsand connectors. It can also be used to monitor and control the automated process. In addition, it can analyze some mathe matical functions like use insignal processing. It will allow also the users to have access in databases ofinformation on its terrain, buildings, and demographics or use in cellularsystem design.

Comparision of textual and graphical programming

Comparision of textual and graphical programming has a good overview of those different ways to write code. With Textual Programming Language you have Low level of abstraction: programming is done at the level of implementation. Inaccurate description of the problem-domain. With Graphical Programming Language you typically work at Higher level of abstraction: programming done on a conceptual level.

There are various reasons why Visual programming is sometimes easier way to write code than traditional writing text source code, but it does not suit to all tasks. Will Visual Programming Ever Go Mainstream? That’s hard to say. Critics have mentioned various problems with the paradigm, not the least of which is that programming is hard. Sometimes programmers find the approach useful at least in learning.

What about Arduino and visual programming? There seems to be some push for that. There are several projects that try to do that.

With this graphical programming environment, most of the children and beginners can now have the chance to learn this programming. It is one way on how taughtchildren use the program Arduino and robotics easy and fast. An Arduino programis awesome when it comes to electronics of education platform.

Scratch was the first graphical programming software I came into contact with, but I think mixly is more compatible for the Arduino study.

BySite Default

3D Touch Auto Leveling Sensor Marlin Setting

Marlin settings:

Marlin settings (take Marlin V1.1.X as example) 3pin cable connects to D11, 2pin cable connects to Zmin.

(1)Set leveling pin, which can’t use the same pin as endstop. Generally, on Delta machines, we use Zmin pin for BLtouch, Zmax pin for endstop .On l3 machines, we use Zmin pin as BLtouch, Zmax pin for endstop or don’t use endstop .

setting 1

(2)Set leveling type.

setting 2

(3)EnableZ__MIN__PROBE__USES__Z__MIN__ENDSTO P__PIN

setting 3

(4)Enable BLtouch.

setting 4

(5)Set the offset value of the leveling switch probe from the nozzle in the XYZ direction .

setting 5

(6)Set leveling mode

setting 6

(7)Set leveling points number

setting 7

(8)Set homing center

setting 8

(9)Store the leveling settings

1) Remove“//”before the “#define EEPROM__SETTINGS’, start M500 to store the data.

setting 9

2) Open Marlin__main.cpp,find’case28://G28:Home all axies, one at a time gcode__G28 (false);’add this sentence:’set __bed __leveling __enabled (true);’It’s important to add this sentence, otherwise the leveling data can’t be stored.

setting 9-2

(10) Remove ‘//’before the ‘#define NUM__SERVOS 3‘

setting 10