In
this blog, we will look into block programming for Arduino. As said in the
introduction, Tinkercad will let us to Programme the Arduino utilizing scratch
and text programming. If you are new to Tinkercad, look at the Tinkercad
tutorial section in the corresponding menu.
To enable the code section in Tinkercad, insert any programmable device, such as an Arduino or Microbit, into the circuit area. After we've placed it, we can access the Programming area by clicking the code menu.
There
are already a few blocks in the programming area that are used to control the
pin13 LED, which is known as the default LED in Arduino. Aside from that, we
can see the two key yellow blocks known as "On Start" and
"Forever," which represent the Arduino's programming structure.
On
Start: - The control block only executes the code once based
on the blocks contained within it. We can use the blocks to start the
communication or to create variables that need to be executed only once during
the procedure.
Forever:
- In
common programming language, the forever block is known as the loop; as the
name implies, this block can run the instructions repeatedly until we power off
the Arduino based on the blocks placed inside it. In other words, this is the
main loop in which we can place our main code.
As
seen in the image below, the six distinct color circles at the top of the
programming area reflect the six different menus of the programming blocks.
Output:
- As
the name implies, we may locate the block to control output components such as
LED buzzers, motors, and display devices. This menu contains the common output
control blocks known as digitalWrite and AnalogWrite(PWM), as well as a few
particular blocks to control the RGB LED, LCD Display, and 7 segment display.
Input:
-
The input menu has a collection of blocks for reading data from various input
devices such as buttons and sensors. There are distinct blocks for reading
digital and analogue data, as well as temperature and ultrasonic sensors.
Notation:
- The
Notation menu blocks allow us to write one comment inside the programming area
for future reference. It enables us to enter remarks at the beginning or finish
of the Programme. The compiler, which runs the Arduino code, does not execute
the notation blocks.
Control:
- The
control menu contains blocks for controlling the Arduino process based on time,
sensor data, or execution count. This menu contains blocks that allow Arduino
to make judgments based on sensor data and perform increment and decrement
operations. Using the blocks in the control menu, we can specify conditions or
thresholds to effectively control the Arduino process.
Math:
- The
math blocks let us to do arithmetic, logical, and comparison operations in our
software based on the requirements. Arithmetic operators are commonly employed
in counting, incrementing, and decrementing operations. The comparison blocks assist
us in comparing two data sets, such as sensor data and a reference value, while
logical operators assist us in performing decision-making procedures.
Variable: - This menu allows us to create a variable and store values in it. Normally, while reading a sensor, we will create a variable to hold the sensor data. The block under this menu enables us to read, write, change, and update variables based on the Arduino process.
Next, under the code menu, we can see the Blocks option and a drop-down menu near it. By choosing that menu, we can see the three options below, which will assist us in selecting the appropriate programming language.
- Blocks:
-
Allows us to write a block code for Arduino
- Blocks
+ Text: - Aids in the conversion of block code to text code.
- Text: - This enables us to develop a text program for the Arduino.
Download:
-
The Icon allows us to download our software in the Arduino.ino format.
Delete:
-
We can eliminate unneeded blocks from our programming Area by dragging them to
the delete icon.






0 Comments