Presentation is loading. Please wait.

Presentation is loading. Please wait.

GPIO Liaison série Entrées analogiques PWM

Similar presentations


Presentation on theme: "GPIO Liaison série Entrées analogiques PWM"— Presentation transcript:

1 GPIO Liaison série Entrées analogiques PWM
Chapitre 2 ARDUINO GPIO Liaison série Entrées analogiques PWM Novembre 2016 J.Callot L.Piedfort

2 General Purpose Input Output
GPIO General Purpose Input Output Novembre 2016 J.Callot L.Piedfort

3 Fonctions Novembre 2016 J.Callot L.Piedfort

4 pinMode() Syntax pinMode(pin, mode) Parameters
pin: the number of the pin whose mode you wish to set mode: INPUT, OUTPUT, or INPUT_PULLUP (R=20K) Returns None Novembre 2016 J.Callot L.Piedfort

5 digitalWrite() Syntax digitalWrite(pin, value) Parameters
pin: the pin number value: HIGH or LOW Returns none Novembre 2016 J.Callot L.Piedfort

6 DigitalRead() Syntax digitalRead(pin) Parameters
pin: the number of the digital pin you want to read (int) Returns HIGH or LOW Novembre 2016 J.Callot L.Piedfort

7 LED de la carte Connectée à l’I/O 13 Defining built-ins: LED_BUILTIN
The constant LED_BUILTIN is the number of the pin to which the on-board LED is connected. void setup() { pinMode(LED_BUILTIN, OUTPUT); } ou pinMode(13, OUTPUT); Novembre 2016 J.Callot L.Piedfort

8 Liaison série Novembre 2016 J.Callot L.Piedfort

9 Principe de la RS232 Novembre 2016 J.Callot L.Piedfort

10 Trame RS232 en transmit sur la ligne
Novembre 2016 J.Callot L.Piedfort

11 Gestion de flux Novembre 2016 J.Callot L.Piedfort

12 Types de liaisons Novembre 2016 J.Callot L.Piedfort

13 Paramètres de trame Nombre de bits de Data Nombre de bits de STOP
Parité Vitesse de transmission en bauds 8bits DATA,1 bit de STOP, pas de parité, vitesse:9600 bauds Novembre 2016 J.Callot L.Piedfort

14 Full duplex half duplex
Novembre 2016 J.Callot L.Piedfort

15 Types d’erreurs possibles
Parity error Framing error Overrun error Novembre 2016 J.Callot L.Piedfort

16 Init du serial Arduino fonction Serial.begin(speed)
void setup() { //Initialize serial and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } Novembre 2016 J.Callot L.Piedfort

17 Envoi de caractères Serial.print(), Serial.println()
Serial.print(val)  Serial.print(val, format) Serial.print("hello word"); i=20; Serial.print(i,HEX) Serial.println() Met un retour à la ligne Novembre 2016 J.Callot L.Piedfort

18 Attente de réception de caractère
Available() Retourne le nombre de caractères reçu dans la fifo de réception while (( n=Serial.available())==0) { } Novembre 2016 J.Callot L.Piedfort

19 Lecture écriture d’un caractère
Read() Lit un caractère reçu Write() écrit un caractère char InByte; InByte = Serial.read(); Serial.write(InByte); Novembre 2016 J.Callot L.Piedfort

20 Programme écho Novembre 2016 J.Callot L.Piedfort

21 Entrées analogiques Novembre 2016 J.Callot L.Piedfort

22 analogRead() Syntax analogRead(pin) Parameters
pin: the number of the analog input pin to read from ( to 5 on most boards, 0 to 7 on the Mini and Nano) Returns int (0 to 1023) Novembre 2016 J.Callot L.Piedfort

23 PWM Phase With Modulation Novembre 2016 J.Callot L.Piedfort

24 analogWrite() Syntax analogWrite(pin, value) Parameters
pin: the pin to write to. value: the duty cycle: between 0 (always off) and 255 (always on). Returns Nothing The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz Novembre 2016 J.Callot L.Piedfort


Download ppt "GPIO Liaison série Entrées analogiques PWM"

Similar presentations


Ads by Google