You are on page 1of 40

programming language for

Arduino
TAGETS OF THIS COURSE

 Can read and write and understand basic C programming


language.

 Can write basic C programming to control


electronic/electrical devices.

 Can understand and communicate with basic circuits,


sensors, actuators.
Studying Programming language and
electrical/electronic components at the same time.
What kind of preson you want to be?

Electronic Mechanical Electrical Lecture


engineer engineer engineer

You will be a/an ……………

Loser officer
Applications Educations, hobby ……
Industrial Applications
RESEACRHING ………..
What kinds of hardwares we need to study ?
• LCD 16x2

•Arduino board

• Real Time module

•Temperature and humidity


module

•Ultrasonic module

•Relay module

•IR module

•DC motor, RC servo


Motor.

RF module.
Language Reference
https://www.arduino.cc/en/Reference/HomePage
C Flow Control 1. C if statement
2. C if … else statement
2. C switch….case statement
2. FOR LOOP
Flowchart of do… while loop

The do..while loop is similar to the while loop with one important difference. The body
ofdo...while loop is executed once, before checking the test expression. Hence,
thedo...while loop is executed at least once.
break Statement
continue Statement
C Programming goto Statement

The use of goto statement may lead to code that is buggy


and hard to follow = try do not use of goto statement
.
C Programming Functions

What is a function in C language ?

A function is a block of code that


performs a specific task.

Why we need to us Functions in


Programming languages ?

Dividing complex problem into small


components makes program easy to
understand and use.
Advantages of user-defined function
• The program will be easier to understand, maintain and debug.
• Reusable codes that can be used in other programs
• A large program can be divided into smaller modules. Hence, a large project
can be divided among many programmers.
Example: User-defined function
Example: Control speed of DC motor.
Arduino – sorting array integers with a bubble sort algorithm

You might also like