
TP_capteur_courant_v2
Dependencies: BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG mbed
Fork of TP_Interfacage_Capteur_Courant by
Diff: main.cpp
- Revision:
- 1:724f5e3b485a
- Parent:
- 0:3cfe1338ab3d
- Child:
- 2:e28e2a1a6d78
--- a/main.cpp Thu Jun 21 08:16:30 2018 +0000 +++ b/main.cpp Thu Jun 21 09:26:09 2018 +0000 @@ -9,8 +9,8 @@ TS_StateTypeDef TS_State; ///////////////////////////////////Déclaration des variables/////////////////////////////////////////// -double tension = 0; -double amp = 0; +float tension = 0; +float amp = 0; int active=0; @@ -136,7 +136,7 @@ if(active==1) //Si flag à 1 { - tension = 0.8*tension + 0.2*((double)anal.read()*3.3); //Acquisition de la tension en entrée du port A4 + tension = 0.8*tension + 0.2*anal.read()*3.3; //Acquisition de la tension en entrée du port A4 amp = (23.307*tension) - (38.521); //Calcul du courant à l'aide de l'équation generée sur excel //y = 23.307x - 38.521