0% found this document useful (0 votes)
201 views

Coding Arduino With MBlock

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views

Coding Arduino With MBlock

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

WHAT IS ARDUINO?

Arduino is a programmable
development board based on
microcontroller. With Arduino, you
can make your own robots as well as
create your own electronic circuits.

Note: We can call Arduino an electronic brain. In order to use this


brain in our projects, we need to program it.
https://studentedge.in/blogs/arduino-tutorial-for-kids-using-mblock
https://lessons.aposteriori.com.sg/10-Arduino-with-mBlock/20-Basic-IO/10-Blink.
html
https://ebotics.com/first-steps-4in1/
https://scratchdotlab.wordpress.com/tag/mblock/
Mblock is a program built on the Scratch programming
language developed by Makeblock. It is currently the most popular
visual programming tool used in Arduino programming.

Click to Download or Open Website of Mblock!


Digital Pins

Usb Input

Power Input: Arduino


also receives power
from the usb input , but
this input is used to
power from an
external source.

Analog Pins

5 Volt Pin Gnd (-) Pin


Usb Input: To connect Arduino to computer

Digital Pins: We use pins to keep our Arduino interacting


with its environment. digital pins
We use it to supply current from Arduino or to flow incoming
currents. E.g; We use digital pins to light a Led that we
connect to Arduino.

Analog Pins: We use analog pins to read the sensors we


connect to Arduino.
ARDUINO BOARDS THAT CAN BE USED WITH MBLOCK

With the Mblock program, you can use cards other than the Arduino Uno model.

Arduino Nano

For projects where size is important, you can choose the Nano model,
which is smaller than Arduino Uno. In addition, there are 8 analog inputs
on the Nano.
ARDUINO MEGA

If the number of pins on the Arduino Uno is not enough, you can use the larger
Mega model.
CONNECTING ARDUINO TO COMPUTER

We connect Arduino to our computer via usb


cable. To see if your computer recognizes
Arduino or how it is connected, right-click on
my computer, open device manager from
properties menu.

The Arduino is connected


to the computer through the Com
port. This port is showing as Com
4. It may have a different Com
point for any computer.

Arduino Uno
Menus

The menu with the


code blocks
required to
program the
Arduino.
Click on Upload
after you finish
coding.

First, connect the Arduino to the


computer. Open the mblock
program. Click on Connect , select
the serial port option and the
Com number the Arduino is
connected to.
LET'S WRITE OUR FIRST PROGRAM
There is a LED connected to the digital pin 9 on the Arduino. We will program
this LED with mBlock.
LEDs are semiconductor circuit elements that convert electrical energy into
light.

Power up pin 9. Light the LED.

Wait 1 second

Turn off the power from pin 9, turn


off the LED.

Wait 1 second

Note: Make sure Arduino is connected and firmware is


loaded from the Connect menu!
BASIC ELECTRONICS

While programming the Arduino, you don't need much electronics


knowledge, but it's good to have basic information about electronics.

Electronics is the science that studies how small electrical currents


must be controlled to operate electronic devices. The computers,
televisions and smart phones we use have all entered our lives thanks to
the science of electronics. In our book, we will examine some electronic
concepts and electronic circuit elements. The circuit elements we will
examine are the parts found in all the electronic devices we use.
Electrical current

An electric current is the flow of tiny


particles called electrons along a wire.
All matter contains electrons.
Electrons are part of the atoms that
make up everything.

Electrons move from the (+) end of the battery to the (-) end.
As a result of this movement, a voltage is formed, we will call
this voltage Voltage and denote it with V. The movement of
electrons from the (+) end to the (-) end will be called current
and denoted by I. Current (I) and voltage (V) are two of the
fundamental components of a circuit. The third essential
component is resistance. Resistance is the difficulty that some
materials show against the flow of electrons, that is, current.

Resistance
ELECTRONIC CIRCUIT ELEMENTS

Resistors are circuit elements


that show difficulty in flowing.
The current that we will give Resistor
Supply Voltage
from the pins with Arduino is
high for the LEDs. Resistors
reduce this value and make it
suitable for LED.

Jumper cable is used to


connect circuit elements
t o g e t h e r. We w i l l c o n n e c t
one end to our Arduino and
the other end to the
breadboard.
LEDs are circuit elements that emit light when current flows
through them. Long end (+) short end (-). The only thing we
need to pay attention to: We will never connect our LED to our
circuit without a resistor. Because LEDs are sensitive circuit
elements, when exposed to high current for a long time, they
may burn and a gas may be released! This gas is dangerous and
should never be inhaled. The resistor will force the current to
reduce the current and make it suitable for our LED.
BREADBOARD

It is used to connect breadboard circuit elements together.


Parts A and D are connected horizontally. Parts B and C are connected
vertically.
FLASHING THE LED ON THE BREADBOARD

10

10

Necessary Materials
The color of the 220
Arduino Uno Ohm resistor is red, red,
brown. The color of the
Breadbord
330 Ohm resistor is
Led
220 Ohm or 330 orange, orange, brown.
Ohm Resistor
WALKING LIGTHS

Necessary Materials

1 Arduino Uno

1 Breadbord

3 Leds

3 20 Ohm ya da 330 Ohm Resistor


POTENTIOMETERS

Potentiometers are adjustable


resistors. The buttons that increase
and decrease the volume of the
devices we use are made with a
potentiometer. By adjusting the
potentiometer, we decrease the
resistance, the sound will increase,
and if we increase the resistance, the
sound will decrease.
The potentiometer has three legs. We
will do our projects by connecting the
leftmost leg to (+), the middle leg to
analog 0, and the rightmost leg to (-).
Necessary Materials
1 Arduino Uno

1 Breadbord

1 Potentiometer

1 Led

1 20 Ohm ya da 330 Ohm Resistor

The codes above transfer the value from analog 0 to digital pin 9 that we
have connected to the LED. A value between 0 and 1024 is sent from the
potentiometer. By dividing the obtained value by 4, we will obtain a value
between 0-255 which are the range of the value of light.
SENSORS

People use their sense organs to perceive the world around them
and what is happening around them.

Machines (Computers, Robots) on the other hand use sensors to


detect what is going on around them.
ULTRASONIC SENSOR

We use the ultrasonic


distance sensor in our
projects to measure
distances to objects.

BUZZER

Buzzer is a type of mini


speaker used for making
sounds, producing warning
sounds, playing simple
music in Arduino projects.
PARKING SENSOR

Necessary Materials

1 Arduino Uno

1 Breadbord

1 Buzzer

1 Ultrasonic Sensor
SOIL MOISTURE SENSOR

We use the soil moisture sensor to measure the amount of water in the soil.

The tip of the sensor will be stuck in the ground. The control circuit, which we
connect to the end part via two cables, evaluates the values received from the
end part and sends them to the Arduino board.

Connect the GND pin to the GND pin on the Arduino board, the VCC pin to the
VCC pin, and the A0 pin to the A0 pin.

If the humidity in the soil is high, a value close to 500 is read. The lower the
humidity, the higher the reading. A maximum of 1023 is read.
According to the value read from the sensor, when the humidity is
good, the RGB Led will turn green, when it is medium, the RGB Led
will turn blue, and when the humidity is bad, the RGB Led will turn
red and the buzzer will make sound.

Necessary Materials
1 Arduino Uno

1 Breadbord

1 Buzzer

1 Soil Moisture Sensor

1 RGB Led

You might also like