Vous êtes sur la page 1sur 21

Arduino coding

Cătălin Vișan
Session Objectives

 Introduce Arduino IDE

 Explain the basic embedded concepts

 Give a code example

 Discuss good coding practices

2
Agenda

 Getting started

 Demo project

 Good practices

 Challenges

3
Getting started

 Google “Arduino IDE” and install it

 Google “Arduino IDE basic tutorial”

 Install the Galileo package

 Run some examples

4
Getting started

5
Getting started

6
Getting started

7
Demo project

 Digital thermometer

 ON/OFF button

 2 LED
 Power
 Read

 Temperature sensor

8
Demo project

9
Demo project

𝑉𝐷𝐷 𝑒𝑥 5𝑉
𝐼𝑂𝐹𝐹 = ֜ = 0.045𝑚𝐴
𝑅𝑃𝑈 + 𝑅𝑖𝑛𝑡 110𝑘Ω
𝑉𝐷𝐷 𝑒𝑥 5𝑉
𝐼𝑂𝑁 = ֜ = 0.5𝑚𝐴
𝑅𝑃𝑈 10𝑘Ω
𝑅𝑖𝑛𝑡 𝑒𝑥 100𝑘Ω
𝑉𝑖𝑛 = 𝑉𝐷𝐷 ֜ 5𝑉 = 4.55𝑉
𝑅𝑖𝑛𝑡 + 𝑅𝑃𝑈 110𝑘Ω

10
Demo project

11
Demo project

12
Demo project

13
Good practices

 States naming

14
Good practices

 Other magic numbers

15
Good practices

 Inline functions

16
Good practices

 Comments
 “What?” comments

 “How?” comments

 “Why?” comments

17
Challenges

 Blocking code vs non-blocking code

18
Challenges

 Size and representation of data types

16𝑏; ∈ [−215 : 215 − 1] 32𝑏; ∈ [0: 232 − 1]

19
Challenges

 Calculus

20
21

Vous aimerez peut-être aussi