E23 007
E23 007
)
) (
)
(
( /( ( /( ( /( )\ ) ( /(
(
)\ )\()) )\()) )\())(()/( )\()) (
)\ (((_) ((_)\ ((_)\ ((_)\ /(_))((_)\ )\
((_) )\___ _((_) ((_) _((_)(_)) _((_)((_)
| __|((/ __|| || | / _ \|_ / |_ _| | \| || __|
| _| | (__ | __ || (_) |/ / | | | .` || _|
|___| \___||_||_| \___//___| |___| |_|\_||___|
1.
2.
3.
4.
5.
6.
7.
8.
start
inisialisasi
read data adc
convert data adc menjadi data suhu
formating data suhu
send data via rs232
delay 5 detik
loop ke 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43. else:
44.
donestamp = time.time()
45.
#
46.
a = obj_regex.match(data1)
47.
data = len(data1)
48.
values = a.group('values')
49.
cursor = conn.cursor ()
50.
query = "INSERT INTO temps(temp_value) VALUES(" + values + ")"
51.
cursor.execute (query)
52.
cursor.close ()
53.
54.
55.
totalbytes += data
56.
totalrcvs += 1
57.
58.
rate = totalbytes/(donestamp - timestamp) * 8 / 1000
59.
print data1, "\n"
60.
print(values)
61.
# print "\nRcvd: %s bytes, %s total in %s s at %s kbps" % (data,
totalbytes, donestamp - timestamp, rate)
| 62.
| 63.
if data1 == 1:
| 64.
# this is the reset, send one byte to trigger
| 65.
totalbytes = 0
| 66.
timestamp = time.time()
| 67.
totalrcvs = 0
| 68.
print "Reset recieved, clearing statistics."
| 69.
| 70. UDPSock.close()
| 71. conn.close ()
+------------------------------------------------------------script PHP(index.php) :
+-----------------------------------------------------------| 01. <head>
| 02. <meta equiv="REFRESH" content="5">
| 03. </head>
| 04. <html>
| 05. <head>
| 06. <title>Monitoring Suhu Ruangan via UDP</title>
| 07. <script language="JavaScript">
| 08. var time = null
| 09. function move() {
| 10. window.location = 'index.php'
| 11. }
| 12. //-->
| 13. </script>
| 14. </head>
| 15. <body onload="timer=setTimeout('move()',10000)">
| 16. <!-- load graph -->
| 17. <img src="graph.php">
| 18. </body>
| 19. </html>
+------------------------------------------------------------script PHP (graph.php)
+------------------------------------------------------------| 00. <?php // content="text/plain; charset=utf-8"
-----[ Referensi :
[x]
[x]
[x]
[x]
[x]
[x]
[x]
http://jpgraph.net/
http://php.net/
http://mysql.com/
http://python.org/
http://mcselec.com/
http://www.atmel.com/products/AVR
http://www.national.com/ds/LM/LM35.pdf
+---------------------------------------------------------+
| ECHO MAGAZINE VOLUME VIII, ISSUE XXIII, PHILE 0x007.TXT |
+---------------------------------------------------------+
|
31 DESEMBER 2010 | http://ezine.echo.or.id
|
+---------------------------------------------------------+