Lit le port analogique du capteur RG100 et convertit la valeur lue en irradiance.
RG100.cpp@1:b6d17e57602b, 2019-06-29 (annotated)
- Committer:
- Station_Meteo_Laos
- Date:
- Sat Jun 29 12:34:11 2019 +0000
- Revision:
- 1:b6d17e57602b
- Parent:
- 0:2971a232b9b1
Lite le c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Station_Meteo_Laos | 0:2971a232b9b1 | 1 | #include "RG100.h" |
Station_Meteo_Laos | 0:2971a232b9b1 | 2 | #include "mbed.h" |
Station_Meteo_Laos | 0:2971a232b9b1 | 3 | |
Station_Meteo_Laos | 0:2971a232b9b1 | 4 | //Il faut faire un étalonage dés que l'on change d'environement |
Station_Meteo_Laos | 0:2971a232b9b1 | 5 | //Au Laos, on prendre 1176.5 comme valeur pour coeff_etalon |
Station_Meteo_Laos | 0:2971a232b9b1 | 6 | //Si un étalonage n'est pas possible, il peut-être aproximer à 1000 |
Station_Meteo_Laos | 0:2971a232b9b1 | 7 | RG100::RG100(PinName analog_pin, float coeff_etalon):analog(analog_pin) |
Station_Meteo_Laos | 0:2971a232b9b1 | 8 | { |
Station_Meteo_Laos | 0:2971a232b9b1 | 9 | coef_etalon = coeff_etalon; |
Station_Meteo_Laos | 0:2971a232b9b1 | 10 | } |
Station_Meteo_Laos | 0:2971a232b9b1 | 11 | |
Station_Meteo_Laos | 0:2971a232b9b1 | 12 | // Capteur à irradiance solaire Solems RG100 |
Station_Meteo_Laos | 0:2971a232b9b1 | 13 | |
Station_Meteo_Laos | 0:2971a232b9b1 | 14 | bool RG100::read( ) |
Station_Meteo_Laos | 0:2971a232b9b1 | 15 | { |
Station_Meteo_Laos | 0:2971a232b9b1 | 16 | irradiance = float(coef_etalon)*analog.read(); |
Station_Meteo_Laos | 0:2971a232b9b1 | 17 | return true; |
Station_Meteo_Laos | 0:2971a232b9b1 | 18 | } |
Station_Meteo_Laos | 0:2971a232b9b1 | 19 | |
Station_Meteo_Laos | 0:2971a232b9b1 | 20 |