-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
=
committed
Mar 30, 2017
0 parents
commit 43e3295
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Temperature chez les Moumou</title> | ||
</head> | ||
<body> | ||
<script src="../js/main.js"></script> | ||
<h1>Will est cool</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
console.log(6*3); | ||
console.log(6/3); | ||
console.log(6+3); | ||
console.log(6-3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import os | ||
import glob | ||
import time | ||
import sqlite3 | ||
|
||
# Module to load | ||
os.system('sudo modprobe w1-gpio') | ||
os.system('sudo modprobe w1-therm') | ||
|
||
# Min to pause | ||
m = 10 | ||
|
||
# Start DB connection | ||
conn = sqlite3.connect('temperatures.db') | ||
c = conn.cursor() | ||
|
||
# Getting the device file | ||
w1_dir = '/sys/bus/w1/devices/' | ||
thermFile = glob.glob(w1_dir + '28*')[0] + '/w1_slave' | ||
|
||
# extract the temperature value | ||
while True: | ||
with open(thermFile) as f: | ||
line = f.readlines() | ||
accept = line[0].split(' ')[-1] | ||
if (accept[0:3] == 'YES'): | ||
# get the value | ||
tp = line[1].split(' ')[-1] | ||
d = str(float(tp[2:7])/1000.0) | ||
|
||
# write in the table | ||
querry = 'INSERT INTO RECORDS VALUES (current_timestamp,' | ||
querry += str(d) | ||
querry += ',\'D1\');' | ||
print(querry) | ||
c.execute(querry) | ||
# Save (commit) the changes on the DB | ||
conn.commit() | ||
time.sleep(60*m) | ||
|
||
|
||
# We close the connection if we are done with it. | ||
conn.close() |
Binary file not shown.