SlideShare a Scribd company logo
1 of 27
INFO 2
Curs 2 - Operatii GPIO
INFO 2
Rezistența
• Limitează curentul
2
INFO 2
Codul culorilor
3
INFO 2
Light Emitting Diode (LED)
• Rezistență 0
• Curent unidirecțional
4
INFO 2
Legea lui Ohm
5
𝐼 =
𝑈
𝑅
INFO 2
Legea lui Ohm
6
I =
U
R
I =
3V
10W+50W+ 60W
= 0.025A = 25mA
INFO 2
Legea I Kirchhoff
7
𝑘
𝑖 𝑘 = 0
INFO 2
Legea I Kirchhoff
8
kik
å = 0
- 1I + 2I + 3I = 0
INFO 2
Legea II Kirchhoff
9
𝑘
𝐸 𝑘 =
𝑘
𝑅 𝑘 𝐼 𝑘
INFO 2
Legea II Kirchhoff
10
kEk
å = kR kIk
å
1L : E = 1I 1R + 3I 3R
2L :0 = 2I 2R - 3I 3R
INFO 2
Exercițiu
• Desenați schema de conectare a unui LED la pinii Arduino.
11
INFO 2
Output Digital
• Bornele unei baterii
• GND
• 5V
• 3,3V
• Pini Digitali
• 0-13
• A0-A5
• Valori LOW (0) sau HIGH (1)
12
INFO 2
Exercițiu
• Desenați schema de conectare a unui LED la Arduino
• Luminează la GPIO - HIGH
• Desenați schema de conectare a unui LED la Arduino
• Luminează la GPIO - LOW
13
INFO 2
Programarea Arduino
• Fișiere .ino - sketch
• C++
• Biblioteci speciale Arduino
• avr-gcc
• AVRDUDE
14
INFO 2
Programul Arduino
15
void setup(){
...
}
void loop(){
...
}
void main (){
setup();
for (;;){
loop()
}
}
INFO 2
Variabile
• char
• byte
• int
• long
• float
• bool
• String
16
char myChar = ‘A’;
myChar = myChar + 1; => ‘B’
String hello = ”Hello”;
String world = ”World”;
String helloworld = hello + ” ” +
world;
INFO 2
Șiruri
17
int myInts[6];
int myPins[] = {2, 4, 8, 3, 6};
int mySensVals[6] = {2, 4, -8, 3, 2};
char message[6] = "hello";
mySensVals[0] = 10;
message[1] == ’e’ => true
INFO 2
Funcții
• pinMode(pin,mode)
• pin – numărul pinului
• mode – INPUT/OUTPUT
• digitalWrite(pin, valoare)
• pin – numărul pinului
• valoare - HIGH/LOW
• delay(ms)
• ms – numărul de milisecunde
• delayMicroseconds(us)
• us – numărul de microsecunde
18
INFO 2
Operanzi
• +-*/
• % - restul împărțirii
• != - diferit
• == - egalitate
• ! – negare logică
• && - și logic
• || - sau logic
19
INFO 2
Structura if-else
20
if (conditie) {
....
}
else {
...
}
if (conditie) {
....
}
else if{
...
}
else{
...
}
Operatori
• ==
• !=
• &&
• ||
INFO 2
Structura while
21
while (condition) {
...
}
do{
...
}
while (condition)
INFO 2
Câte iterații se vor face în fiecare caz?
22
int x = 0;
while (x!=0) {
x = x+1;
}
int x = 0;
do{
x = x+1;
}
while (x!=0)
INFO 2
Structura for
23
for (initialization; condition; operation) {
…
}
INFO 2
Câte iterații se vor face în fiecare caz?
24
for (int i=0; i<20; i++){
digitalWrite(i, HIGH);
}
int x = 1;
for (int i=10; i>0; i = i-x){
digitalWrite(i, HIGH);
x = x + 1;
}
INFO 2
Consola serială
• Comunicare Arduino – alte dispozitive
• Pini 0 și 1
• Serial.begin(rate)
• Rate – 9600
• Serial.println(text)
• Text - string
25
INFO 2
Sumar
• Elemente de electronică digitală
• Legea lui Ohm
• Legile lui Kirchhoff
• LED
• GPIO
• Programare Arduino
26
INFO 2
?
Întrebări
27

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Arduino - GPIO

Editor's Notes

  1. Limiteaza curentul
  2. 3 cifre * factor multiplicare + toleranta
  3. Curentul de la + la – In led de la anod la catod Catodul e mai lat – tun de electroni
  4. Rezistente serie si paralel
  5. + - rezistenta si led
  6. Paralela curentul si apa
  7. Arduino e C++ la care se adauga niste biblioteci Poti rula C++ pe Arduino, invers s-ar putea sa nu mearga Se poate folosi orice editor si se pot scrie fisiere C++ Ai nevoie de compilator avr-gcc AVRDUDE scrie
  8. Ce e mic e ce scriem noi Arduino etapa de preprocesare Ia functiile declarate jos si le declara sus Genereaza codul mare
  9. Char – 8 biti byte – 8 biti (unsigned) – 0-255 , numere Int – 2 bytes – arduino uno , pe due e 4 bytes , ce valori pot sa fie (-2^15 pana la 2^15-1) Long – 4 bytes -2^31 – 2^31 – 1 Float – cu virgula, de evitat Bool – true/false String – instanta de clasa, sir de caractere Memorie putina, sa foloseasca cat de putin
  10. Nicio iteratie infinit
  11. 20 de iteratii Calculam...
  12. Rate – bits/second 96000