目前共有10篇帖子。 內容轉換:不轉換▼
 
點擊 回復
415 9
[測量]現在室內的溫度
一派護法 十九級
1樓 發表于:2015-6-19 20:38

[octopus@pc3 tools]$ ./temperature
Can't open serial port!
[octopus@pc3 tools]$ sudo chmod 777 /dev/ttyUSB0
[sudo] password for octopus:
chmod: cannot access ‘/dev/ttyUSB0’: No such file or directory
[octopus@pc3 tools]$ sudo chmod 777 /dev/ttyUSB0
[octopus@pc3 tools]$ ./temperature
Temperature:
28.81℃    28.68℃    28.68℃    28.68℃    28.75℃    28.75℃    28.75℃    28.75℃    
28.75℃    28.75℃    28.75℃    28.75℃    28.75℃    28.75℃    28.75℃    28.81℃    
28.81℃    28.75℃    28.81℃    -0.68℃    28.81℃    28.87℃    28.87℃    28.87℃    
28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    
28.87℃    28.87℃    28.87℃    28.93℃    28.93℃    28.93℃    29.00℃    29.00℃    
29.00℃    29.00℃    28.93℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.12℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.12℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.12℃    29.06℃    29.06℃    29.12℃    29.06℃    
29.06℃    29.06℃    29.12℃    29.12℃    29.06℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    
29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.06℃    29.12℃    29.06℃    29.12℃    
29.12℃    29.06℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    29.12℃    29.18℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    29.18℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    29.18℃    
29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.06℃    29.06℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    
29.18℃    29.25℃    29.25℃    29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    
29.25℃    29.18℃    29.18℃    29.25℃    29.25℃    29.25℃    29.25℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.25℃    29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.06℃    29.06℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.12℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    
29.12℃    29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.12℃    29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.18℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    
29.18℃    29.25℃    29.18℃    29.25℃    29.25℃    29.18℃    29.25℃    29.18℃    
29.25℃    29.18℃    29.25℃    29.25℃    29.18℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.31℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    

一派護法 十九級
2樓 發表于:2015-6-19 20:39

溫度傳感器:DS18B20
本程序將非電學量轉換成了電學量,又將電學量轉換成了計算機量。
一派護法 十九級
3樓 發表于:2015-6-19 20:39

[octopus@pc3 tools]$ ./temperature
Can't open serial port!
[octopus@pc3 tools]$ sudo chmod 777 /dev/ttyUSB0
[sudo] password for octopus:
chmod: cannot access ‘/dev/ttyUSB0’: No such file or directory
[octopus@pc3 tools]$ sudo chmod 777 /dev/ttyUSB0
[octopus@pc3 tools]$ ./temperature
Temperature:
28.81℃    28.68℃    28.68℃    28.68℃    28.75℃    28.75℃    28.75℃    28.75℃    
28.75℃    28.75℃    28.75℃    28.75℃    28.75℃    28.75℃    28.75℃    28.81℃    
28.81℃    28.75℃    28.81℃    -0.68℃    28.81℃    28.87℃    28.87℃    28.87℃    
28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    28.87℃    
28.87℃    28.87℃    28.87℃    28.93℃    28.93℃    28.93℃    29.00℃    29.00℃    
29.00℃    29.00℃    28.93℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    
29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.00℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.12℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.06℃    29.12℃    29.06℃    
29.06℃    29.06℃    29.06℃    29.12℃    29.06℃    29.06℃    29.12℃    29.06℃    
29.06℃    29.06℃    29.12℃    29.12℃    29.06℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    
29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.06℃    29.12℃    29.06℃    29.12℃    
29.12℃    29.06℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    29.12℃    29.18℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    29.18℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    29.18℃    
29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.06℃    29.06℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    
29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    
29.18℃    29.25℃    29.25℃    29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    
29.25℃    29.18℃    29.18℃    29.25℃    29.25℃    29.25℃    29.25℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.25℃    29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.06℃    29.06℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.12℃    29.12℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.12℃    29.18℃    29.18℃    29.12℃    29.12℃    29.12℃    29.18℃    29.18℃    
29.12℃    29.18℃    29.18℃    29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.12℃    29.18℃    29.18℃    29.12℃    29.18℃    29.12℃    29.18℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.12℃    29.12℃    
29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    
29.18℃    29.25℃    29.18℃    29.25℃    29.25℃    29.18℃    29.25℃    29.18℃    
29.25℃    29.18℃    29.25℃    29.25℃    29.18℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.31℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    29.18℃    
29.18℃    29.18℃    29.18℃    29.25℃    29.18℃    29.25℃    29.18℃    29.18℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.31℃    29.31℃    29.25℃    29.31℃    29.31℃    29.25℃    
29.25℃    29.25℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    
29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    
29.31℃    29.31℃    29.31℃    29.31℃    29.37℃    29.31℃    29.31℃    29.31℃    
29.31℃    29.31℃    29.37℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    
29.31℃    29.31℃    29.31℃    29.31℃    29.25℃    29.25℃    29.25℃    29.31℃    
29.25℃    29.25℃    29.31℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.31℃    29.25℃    29.25℃    29.25℃    29.25℃    29.31℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.31℃    29.31℃    29.31℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.31℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.31℃    
29.31℃    29.31℃    29.31℃    29.31℃    29.25℃    29.25℃    29.25℃    29.31℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
[octopus@pc3 tools]$

一派護法 十九級
4樓 發表于:2015-6-19 20:40

  -0.68℃ 
這是一個錯誤的數據
一派護法 十九級
5樓 發表于:2015-6-19 20:41

公布部分C程序代碼(電腦端):
#include <stdio.h>
#include "UART.h"

#define DSNEG 4
#define DSERR 6

#define BIT(n) 1<<n

char buffer[513];

void get_temperature(float* temp)
{
    UART_Send(0x83);
    usleep(100000);
    UART_Receive(buffer);
    if (buffer[1]&BIT(DSERR))
        *temp=-999.99;
    else
    {
        *temp=buffer[2]*1.00+buffer[3]*0.01;
        if (buffer[1]&BIT(DSNEG))
            *temp=-*temp;
    }
}

void display_temperature(float* temp)
{
    printf("%.2f℃\t",*temp);
}

int main(int argc, char* argv[])
{
    int i=1000,j;
    float temp=0.00;
    if (UART_Open()==0)
        return -1;
   
    if (argc>=2)
        i=atoi(argv[1]);
    printf("Temperature: \n");
    for (j=0;j<i;j++)
    {
        get_temperature(&temp);
        display_temperature(&temp);
        if (j%8==7 || j+1==i)
            printf("\n");
        sleep(1);
    }
   
    USART_Close();
    return 0;
}

一派護法 十九級
6樓 發表于:2015-6-19 20:42

#include <stdio.h> //standard input / output functions
#include <stdlib.h>
#include <string.h> //string function definitions
#include <unistd.h> //UNIX standard function definitions
#include <fcntl.h> //File control definitions
#include <errno.h> //File control definitions
#include <termios.h> //POSIX terminal control definitions
#include "UART.h"

struct termios tty;
struct termios tty_old;
int UART_id=0;

int UART_Open(void)
{
    memset(&tty,0,sizeof(tty));
    UART_id=open("/dev/ttyUSB0",O_RDWR|O_NOCTTY|O_NDELAY);
    if (UART_id<0)
    {
        printf("Can't open serial port!\n");
        return 0;
    }
    
    /* Error Handling */
    if (tcgetattr(UART_id,&tty)!=0)
    {
        printf("Error: %d from tcgetattr: %s \n",errno,strerror(errno));
        return 0;
    }
    
    /* Save old tty parameters */
    tty_old=tty;
    
    /* Set Baud Rate */
    cfsetospeed(&tty,(speed_t)B9600);
    cfsetispeed(&tty,(speed_t)B9600);
    
    /* Setting other Port Stuff */
    tty.c_cflag&=~PARENB; //Make 8n1
    tty.c_cflag&=~CSTOPB;
    tty.c_cflag&=~CSIZE;
    tty.c_cflag|=CS8;
    
    tty.c_cflag&=~CRTSCTS; //no flow control
    tty.c_cc[VMIN]=1; //read doesn't block
    tty.c_cc[VTIME]=5; //0.5 seconds read timeout
    tty.c_cflag|=CREAD|CLOCAL; //turn on READ & ignore ctrl lines
    
    /* Make raw */
    cfmakeraw(&tty);
    
    /* Flush Port, then applies attributes */
    tcflush(UART_id,TCIFLUSH);
    if (tcsetattr(UART_id,TCSANOW,&tty)!=0)
    {
        printf("Error: %d from tcgetattr \n",errno);
        return 0;
    }
    
    return UART_id;
}

void UART_Send(unsigned char Byte)
{
    write(UART_id,&Byte,1);
    //It was definitely not necessary to write byte per byte, also int n_written = write( UART_id, cmd, sizeof(cmd) -1) worked fine.
}

int UART_Receive(char* buf)
{
    int len=read(UART_id,buf,512);
    buf[len]='\0';
    return len;
}

void USART_Close()
{
    close(UART_id);
}

一派護法 十九級
7樓 發表于:2015-6-19 20:44

單片機端主要實現了:串口通訊,DS18B20溫度讀取。
一派護法 十九級
8樓 發表于:2015-6-19 20:48

本程序是我2013年12月寫的。
一派護法 十九級
9樓 發表于:2015-6-19 22:14

[octopus@pc3 tools]$ ./temperature
Temperature:
0.00℃    29.06℃    29.06℃    29.12℃    29.12℃    29.12℃    29.12℃    29.12℃    
29.12℃    29.18℃    29.18℃    29.18℃    29.18℃    29.25℃    29.25℃    29.18℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.31℃    29.31℃    
29.25℃    29.31℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    29.25℃    
29.31℃    29.25℃    29.31℃    29.31℃    29.31℃    29.31℃    29.37℃    29.31℃    
29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    
29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    29.31℃    
29.31℃    29.31℃    29.31℃    29.25℃    29.31℃    29.31℃    29.31℃    29.25℃    

一派護法 十九級
10樓 發表于:2015-6-20 12:18

[octopus@pc3 tools]$ ./temperature
Temperature:
85.00℃    27.75℃    27.81℃    27.81℃    27.81℃    27.81℃    27.87℃    27.87℃    
27.87℃    27.87℃    27.87℃    27.93℃    27.93℃    27.93℃    27.93℃    27.93℃    
27.93℃    27.93℃    28.00℃    28.00℃    28.00℃    27.93℃    28.00℃    28.00℃    
27.93℃    28.00℃    28.00℃    28.00℃    28.00℃    28.00℃    27.93℃    27.93℃    
27.93℃    28.00℃    27.93℃    28.00℃    28.00℃    28.00℃    28.00℃    28.00℃    
28.00℃    28.00℃    28.00℃    28.00℃    28.00℃    28.00℃    28.00℃    28.06℃    
28.00℃    28.00℃    28.00℃    28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    
28.06℃    28.06℃    28.06℃    28.06℃    28.12℃    28.06℃    28.06℃    28.06℃    
28.06℃    28.06℃    28.12℃    28.06℃    28.12℃    28.12℃    28.12℃    28.12℃    
28.12℃    28.12℃    28.12℃    28.12℃    28.18℃    28.12℃    28.12℃    28.12℃    
28.12℃    28.12℃    28.12℃    28.12℃    28.12℃    28.12℃    28.06℃    28.06℃    
28.06℃    28.06℃    28.00℃    28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    
28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    
28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    28.06℃    28.12℃    28.06℃    
28.06℃    28.06℃    28.12℃    28.12℃    28.06℃    28.12℃    28.06℃    28.06℃    
28.06℃    28.12℃    28.12℃    28.06℃    28.12℃    28.12℃    28.12℃    28.12℃    
28.06℃    28.12℃    28.12℃    28.12℃    28.12℃    28.12℃    28.06℃    28.12℃    
28.12℃    28.12℃    28.12℃    28.12℃    28.06℃    28.12℃    28.12℃    28.12℃    
28.12℃    28.12℃    28.12℃    28.12℃    28.12℃    28.12℃    28.12℃    28.12℃    

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:415 回複數:9
評論數: ?
作者: 巨大八爪鱼
最後回復:巨大八爪鱼
最後回復時間:2015-6-20 12:18
 
©2010-2024 Arslanbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。