5 ' --- Station Météo --- 10 const device = 3B 15 lcdinit : cls : csroff 20 ' --- Déclaration des variables utilisées --- 21 dim U1 as integer : dim U2 as integer : dim U3 as integer 22 dim UP as integer : dim UH as integer 23 dim TK as integer : dim P as integer : dim RH as byte : dim TC as byte 30 ' --- Affichage du message d'accueil --- 35 locate 0,0 : print "* Station Meteo*" : locate 0,1 : print "(c) ELEKTOR 2008" : delay 5000 40 ' --- Mesure des différentes tensions --- 41 U1 = ADIN(1) 42 U2 = ADIN(2) 43 U3 = ADIN(3) 50 ' --- Conversion des tensions en phénomènes physiques --- 60 ' --- Conversion Tension / Température 65 TK = ((64*U1) / 131) 70 if TK >= 273 then TC = TK - 273 75 if TK < 273 then TC = 273 - TK 80 ' --- Conversion Tension / Pression 85 UP = ((50*U2)/102) 90 P = ((((100*UP)/5)+950)/9) 100 ' --- Conversion Tension / Hygrométrie 105 UH = ((50*U3)/102) 110 RH = ((((100*UH)/5)-1600)/62) 120 ' --- Gestion des affichages successifs --- 125 cls 130 if TK >= 273 then gosub 1000 135 if TK < 273 then gosub 2000 140 out 0,1 : delay 300 : out 0,0 145 delay 5000 150 cls 155 locate 0,0 : print "Pression : " 160 locate 4,1 : print DEC (P);" mbars" : locate 1,1 : print "P = " 165 out 0,1 : delay 300 : out 0,0 170 delay 5000 175 cls 180 locate 0,0 : print "Hygrometrie : " 185 locate 2,1 : print "RH = ": locate 6,1 : print DEC (RH);" %" 190 out 0,1 : delay 300 : out 0,0 195 delay 5000 200 cls 210 locate 0,0 : print "Tendance : " 215 if P < 980 then locate 0,1 : print " Tempete " 220 if P >= 980 and P < 1000 then locate 0,1 : print " Pluie / Vent " 225 if P >= 1000 and P < 1025 then locate 0,1 : print " Variable " 230 if P >= 1025 and P < 1040 then locate 0,1 : print " Beau Temps " 235 if P >= 1040 then locate 0,1 : print "Tres sec" 240 out 0,1 : delay 300 : out 0,0 245 delay 5000 250 goto 41 1000 ' --- Affichage d'une température positive --- 1010 locate 0,0 : print "Temperature : " : locate 4,1 : print dec (TC);" deg.C" : locate 2,1 : print "T = " 1020 return 2000 ' --- Affichage d'une température négative --- 2010 locate 0,0 : print "Température : " : locate 4,1 : print dec (TC);" deg.C" : locate 2,1 : print "T = -" 2020 return