Add files via upload

master
Wojciech Kaczmarski 2019-11-14 17:58:12 +01:00 committed by GitHub
parent 61ab9817ac
commit 4e0e1f5d39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -22,7 +22,7 @@ FAN_R = 6
FAN_L = 7
#vars
fan_L_sp=100
fan_L_sp=20
fan_R_sp=20
#----------------------------------------------------------------------------
@ -162,13 +162,19 @@ while True:
u_psu=0
u_bat=0
i_bat=0
for i in range(1000):
u_psu+=adc.read(0)
u_bat+=adc.read(1)
i_bat+=adc.read(2)-adc.read(3)
u_psu/=1000.0
u_bat/=1000.0
i_bat/=1000.0
u_psu*=14.46/1576.5
u_bat*=14.51/1576.5 #might need to change coeffs
i_bat*=1.0
#overwrite
with open('/var/www/html/vals.txt', 'r') as file:
@ -181,6 +187,7 @@ while True:
data[5] = str(u_psu) + '\n'
data[6] = str(left_fan) + '\n'
data[7] = str(right_fan) + '\n'
data[7] = str(i_bat) + '\n'
with open('/var/www/html/vals.txt', 'w') as file:
file.writelines(data)