参考の記事
http://kuc-arc-f.com/agri/?product=product-post-3
========================================================
ARDUINO - RasPi で、シリアル通信行い。
給水判定後、給水指示を送信します。
#code
https://github.com/kuc-arc-f/python-server-typ-c2
# class:
https://github.com/kuc-arc-f/python-server-typ-c2/blob/master/agri_serial/com_func.py
# 判定処理
マスターDB値の、センサ既定値と、水分センサ値を比較
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
# @return TRUE: opne-Valve | |
def Is_validValve(self, iSen , iMoi): | |
clsConst = com_appConst.appConstClass() | |
ret=clsConst.mNG_CODE | |
if(iMoi > iSen ): | |
ret=clsConst.mOK_CODE | |
return ret |
# 判定処理、レスポンスの作成
マイコン送信用のレスポンス作成。
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
def getResponse(self, dicGet , dicMst): | |
ret ="000000000000000000000000" | |
ret2="" | |
k_flg_1=self.Is_validValve( int(dicGet["snum_1"]) ,dicMst["moi_num"]) | |
k_flg_2=self.Is_validValve( int(dicGet["snum_2"]) ,dicMst["moi_num"]) | |
k_flg_3=self.Is_validValve( int(dicGet["snum_3"]) ,dicMst["moi_num"]) | |
k_flg_4=self.Is_validValve( int(dicGet["snum_4"]) ,dicMst["moi_num"]) | |
sMoi= self.getZero_byNum(str(dicMst["moi_num"]) ,4) | |
sKai= self.getZero_byNum(str(dicMst["kai_num_1"]) ,3) | |
ret2=ret2+sMoi | |
if dicMst["vnum_1"]==1L: | |
ret2=ret2+str(k_flg_1) | |
else: | |
ret2=ret2+"0" | |
if dicMst["vnum_2"]==1L: | |
ret2=ret2+str(k_flg_2) | |
else: | |
ret2=ret2+"0" | |
if dicMst["vnum_3"]==1L: | |
ret2=ret2+str(k_flg_3) | |
else: | |
ret2=ret2+"0" | |
if dicMst["vnum_4"]==1L: | |
ret2=ret2+str(k_flg_4) | |
else: | |
ret2=ret2+"0" | |
ret2=ret2 + sKai + "000000000" | |
#print ret2 | |
return ret2 |
*) 開発者向けのまとめ記事
http://knaka0209.blogspot.jp/2015/04/agri.html
0 件のコメント:
コメントを投稿