Académique Documents
Professionnel Documents
Culture Documents
TP n° 7
BLYNK
1
Table des matières
1 Partie pratique 3
1.1 Installation d’une plateforme IoT BLYNK en standalone . . . . . . . . . . . 4
1.2 Capter des données et les afficher sur la plateforme . . . . . . . . . . . . . . 4
1.2.1 Montage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2
Chapitre 1
Partie pratique
3
1.1 Installation d’une plateforme IoT BLYNK en standalone
On suit la documentation de Blynk sur Github pour l’installer localement sur Raspberry
Pi.. Pour accomplir les taches suivantes, on a besoin de l’application mobile Blynk (legacy)
https://github.com/blynkkk/blynk-library
1.2.1 Montage
Figure 1.1
1
2 #i n c l u d e <SPI . h>
3 #i n c l u d e <WiFiNINA . h>
4 #i n c l u d e <BlynkSimpleWiFiNINA . h>
5 #d e f i n e BLYNK_AUTH_TOKEN "TOKEN"
6 #d e f i n e BLYNK_PRINT S e r i a l
7
8 c h a r auth [ ] = BLYNK_AUTH_TOKEN;
9 c h a r s s i d [ ] = "NOM_SSID_WIFI" ;
10 c h a r p a s s [ ] = "MOT_DE_PASSE_WIFI" ;
11
4
12 c o n s t i n t l d r P i n = A1 ;
13 int ldrStatus ;
14
15 BLYNK_WRITE(V0)
16 {
17 i n t v a l u e = param . a s I n t ( ) ;
18 Blynk . v i r t u a l W r i t e (V1 , v a l u e ) ;
19 }
20
21 v o i d myTimerEvent ( )
22 {
23 Blynk . v i r t u a l W r i t e (V1 , l d r S t a t u s ) ;
24 }
25
26 void setup ( ) {
27 S e r i a l . begin (115200) ;
28 Blynk . b e g i n ( auth , s s i d , pass , IPAddress ( 1 9 2 , 1 6 8 , 4 3 , 2 1 ) , 8 0 8 0 ) ;
29 pinMode ( l d r P i n , INPUT) ;
30 }
31
32 void loop ( )
33 {
34 Blynk . run ( ) ;
35 l d r S t a t u s = analogRead ( l d r P i n ) ;
36 delay (2000) ;
37 }
38 }