File tree Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < title > Temperature chez les Moumou</ title >
6
+ </ head >
7
+ < body >
8
+ < script src ="../js/main.js "> </ script >
9
+ < h1 > Will est cool</ h1 >
10
+ </ body >
11
+ </ html >
Original file line number Diff line number Diff line change
1
+ console . log ( 6 * 3 ) ;
2
+ console . log ( 6 / 3 ) ;
3
+ console . log ( 6 + 3 ) ;
4
+ console . log ( 6 - 3 ) ;
Original file line number Diff line number Diff line change
1
+ import os
2
+ import glob
3
+ import time
4
+ import sqlite3
5
+
6
+ # Module to load
7
+ os .system ('sudo modprobe w1-gpio' )
8
+ os .system ('sudo modprobe w1-therm' )
9
+
10
+ # Min to pause
11
+ m = 10
12
+
13
+ # Start DB connection
14
+ conn = sqlite3 .connect ('temperatures.db' )
15
+ c = conn .cursor ()
16
+
17
+ # Getting the device file
18
+ w1_dir = '/sys/bus/w1/devices/'
19
+ thermFile = glob .glob (w1_dir + '28*' )[0 ] + '/w1_slave'
20
+
21
+ # extract the temperature value
22
+ while True :
23
+ with open (thermFile ) as f :
24
+ line = f .readlines ()
25
+ accept = line [0 ].split (' ' )[- 1 ]
26
+ if (accept [0 :3 ] == 'YES' ):
27
+ # get the value
28
+ tp = line [1 ].split (' ' )[- 1 ]
29
+ d = str (float (tp [2 :7 ])/ 1000.0 )
30
+
31
+ # write in the table
32
+ querry = 'INSERT INTO RECORDS VALUES (current_timestamp,'
33
+ querry += str (d )
34
+ querry += ',\' D1\' );'
35
+ print (querry )
36
+ c .execute (querry )
37
+ # Save (commit) the changes on the DB
38
+ conn .commit ()
39
+ time .sleep (60 * m )
40
+
41
+
42
+ # We close the connection if we are done with it.
43
+ conn .close ()
You can’t perform that action at this time.
0 commit comments