1. Trang chủ
  2. » Luận Văn - Báo Cáo

Lap 1 introduction to arduino & arduino programming

23 0 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Lap 1 Introduction to Arduino & Arduino Programming
Tác giả Hoàng Trung Dũng, Nguyễn Hoàng Tuấn Dũng, Trịnh Quang Hựng, Lương Minh Kha, Hồ Phỳc Quõn
Trường học Ho Chi Minh City University of Industry and Trade
Chuyên ngành Electrical Engineering / Programming
Thể loại Giáo trình
Năm xuất bản 2024
Thành phố Ho Chi Minh City
Định dạng
Số trang 23
Dung lượng 3,4 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

INTRODUCTION TO ARDUINO _ Arduino is an open-source electronics platform based on easy-to-use hardware and software.. To do so you use the Arduino programming language based on Wiring, a

Trang 1

HO CHI MINH CITY UNIVERSITY OF

INDUSTRY AND TRADE

Trang 4

LIST OF FIGURE

Figure 4 HARDWARE TASK 2.3 PART 1

Figure 5 HARDWARE TASK 2.3 PART 2

Figure 6 PROTEUS TASK 2.4.00 cccccccccecceeneneetetsenensecseseneenensecreeceeceeteceenesessesieceenesscrenesneeenes 9

Figure 7 PROTEUS TASK 2.5.00 cccccccecescnereeteteenenseceetensenensecreecrenenesreneerseeseereneseeeeereseee 10

i50 603 (94950189.53.0 27A 13

Trang 5

ACKNOWLEDGEMENT

1 would like to thank the following people, without whom |

would not have been able to complete this research, and without

whom | would not have made it through my masters degree!

I hereby declare that this thesis was carried out by myself

under the guidance and supervision of and that the work contained

and the results in it are true by author and have not violated

research ethics The data and figures presented in this thesis are for

analysis, comments, and evaluations from various resources by my

own work and have been duly acknowledged in the reference part

In addition, other comments, reviews and data used by other

authors, and organizations have been acknowledged, and explicitly

Trang 6

CHAPTER 1: INTRODUCTION TO ARDUINO

1 INTRODUCTION TO ARDUINO _

Arduino is an open-source electronics platform based on easy-to-use

hardware and software Arduino boards are able to read inputs -

light on a sensor, a finger on a button, or a Twitter message - and

turn it into an output - activating a motor, turning on an LED,

publishing something online You can tell your board what to do by

sending a set of instructions to the microcontroller on the board To

do so you use the Arduino programming language (based on

Wiring), and the Arduino Software (IDE), based on Processing

Over the years Arduino has been the brain of thousands of projects,

from everyday objects to complex scientific instruments A

worldwide community of makers - students, hobbyists, artists,

programmers, and professionals - has gathered around this open-

source platform, their contributions have added up to an incredible

amount of accessible knowledge that can be of great help to novices

and experts alike

Arduino was born at the Ivrea Interaction Design Institute as an easy

tool for fast prototyping, aimed at students without a background in

electronics and programming As soon as it reached a wider

community, the Arduino board started changing to adapt to new

needs and challenges, differentiating its offer from simple 8-bit

boards to products for loT applications, wearable, 3D printing, and

embedded environments

Trang 7

II INSTALLING ARDUINO DEVELOPMENT ENVIRONMENT _

In order to write a code, the text/code editor is required A compiler

is then required to translate the written code into binary files or

machine code, which the>microcontroller>then can

understand.>Programming>software is also required in order to load

the firmware files to the microcontroller

An Integrated Development Environment, which can be described

simply as Arduino Software, 1s what we refer to when we are

combining all of these functionalities with some extras like console

support, debugging support, etc

The development IDE that is suited for Arduino boards is known by

the moniker Arduino IDE It has a compiler, code editor, serial

console, programmer, serial plotter, as well as many other

capabilities that are fully featured Also, it is straightforward and

simple to use

The Arduino IDE can be described as a cross-platform and can

function on Microsoft, Linux, and Windows operating systems

Additionally, you may program these boards utilizing the C/C++-

derived Arduino Language and Arduino IDE

Writing code and uploading it onto the circuit board while offline is

simple with Arduino Software Every>Arduino board>is compatible

with this software

Arduino IDE is now available in two different versions: 1.x.x and 2.x

IDE 2.x is a brand-new major update that outperforms IDE 1.x.x in

terms of speed and>power It also has more _ sophisticated

capabilities to aid users in their debugging and coding in addition to

more contemporary editor and a responsive user interface

The installation of the Arduino IDE is rather simple To obtain the

most recent edition of the Arduino IDE, visit Arduino IDE For several

operating systems, including Windows, Linux, and Mac, there are

numerous versions available

Additionally, there are now two versions of the IDE: 1.x as well as

2.x In this tutorial, we ll focus on Classic 1.X version In essence,

both offer nearly identical functionality having its different GUI and a

few extra capabilities, including automatic code completion

LJ Click the aforementioned link to download any installer for the OS

system

Oi Open that exe file after the download is complete

Trang 8

LJ Click “Next” to proceed after accepting the license agreement and

deciding whether or not to install the IDE for all users

LJ Click “Install” after deciding whether you wish to alter the default

installation location for the IDE or leave it alone

C1 After the installer has completed installing, click “Close.”

Trang 9

Ill CONFIGURATION OF THE ARDUINO PROGRAM _

The>setup()>function is called when a sketch starts Use it to initialize

variables, pin modes, start using libraries, etc The>setup()>function

will only run once, after each powerup or reset of the Arduino board

Arduino programs can be divided in three main parts:>Structure,

Values>(variables and constants), and>Functions In this tutorial,

we will learn about the Arduino software program, step by step, and

how we can write the program without any syntax or compilation

error

Trang 10

CHAPTER 2: ARDUINO PROGRAMMING

Table 1 LAB EQUIPMENT

Trang 11

- Change the duty cycle (on/off interval) and see how it works

In 1 cycle, time On is Is off is 2s, output 5v in 1s and Ov in 2s

Trang 12

TASK 2.3: LED BLINK WITH BREADBOARD Procedure

1 Use Fritzing tool to draw a circuit diagram as shown in Figure 2

2 Connect LED, and resistor 100 Q via breadboard and Pin 10 on Arduino (figure 2)

Figure 3 PROTEUS TASK 2.3

3 Write the code with Arduino IDE:

- LED works in duty cycle: Turn on in 1s and off in Is

Figure 4 HARDWARE TASK 2.3 PART 1

Trang 13

- Print message 1n Serial monitor:

+ Print “LED on” in Serial monitor when turning LED on

+ Print “LED off’ in Serial monitor when turning LED off

Figure 5 HARDWARE TASK 2.3 PART 2

Trang 14

TASK 2.4: LEDS IN SERLAL MODE Procedure

1 Connect 3 LEDs, and resistor 220 Q via breadboard in serial connection and Pin 10 on Arduino

Figure 6 PROTEUS TASK 2.4

2 Write the code with Arduino IDE:

- LED works in duty cycle: Turn on in 1s and off in Is

- Print message 1n Serial monitor:

+ Print “3 LED in serial mode on” in Serial monitor when turning LED

on

+ Print “3 LED in serial mode off’ in Serial monitor when turning LED off

Trang 15

TASK 2.5: LEDS IN PARALLEL MODE Procedure

1 Connect 3 LEDs, and resistor 220 Q via breadboard in parallel mode and Pin 10 on Arduino

SIMULINO UNO

Figure 7 PROTEUS TASK 2.5

2 Write the code with Arduino IDE:

- LED works in duty cycle: Turn on in 1s and off in Is

- Print message 1n Serial monitor:

+ Print “3 LED in parallel mode on” in Serial monitor when LED on

+ Print “3 LED in parallel mode off” in Serial monitor when LED off

Trang 16

Figure 8 HARDWARE TASK 2.5

Trang 17

TASK 2.6: TURN ON/OFF LED IN SEQUENCING

Figure 9 PROTEUS TASK 2.6

2 Write the code with Arduino IDE: - LED turn ON/OFF in sequencing

(order 1, 2, 3, .)

Trang 18

Figure 10 HARDWARE TASK 2.6 PART 1

Figure 11 HARDWARE TASK 2.6 PART 2

Trang 19

Figure 12 HARDWARE TASK 2.6 PART 3

Trang 20

TASK 2.7: MAKE A TRAFFIC LIGHT SYSTEM Procedure

1 Use 3 LEDs (Red, green, yellow) and resistor 220 Q to connect to 3

pin Digital 1/O on Arduino

Figure 13 PROTEUS TASK 2.7 PART 1

Trang 21

Figure 15 PROTEUS TASK 2.7 PART 3

Trang 22

2 Make a traffic light system:

+ Green LED turn ON in 30s

+ Yellow LED on in 3s + Red LED on in 20s

+ Working continously in this cyclE

Figure 18 HARDWARE TASK 2.7 PART 3

Ngày đăng: 16/05/2025, 16:27

w