質問編集履歴
1
2回のデータ送信の間にCSを一度Hに戻す操作を加えてた
test
CHANGED
File without changes
|
test
CHANGED
@@ -86,21 +86,37 @@
|
|
86
86
|
|
87
87
|
print('send_data:{}'.format(send_data))
|
88
88
|
|
89
|
+
|
90
|
+
|
89
|
-
|
91
|
+
w.digitalWrite(cs_pin, 0)
|
90
92
|
|
91
93
|
time.sleep(0.1)
|
92
94
|
|
93
95
|
spi.xfer2(send_data)
|
94
96
|
|
97
|
+
w.digitalWrite(cs_pin, 1)
|
98
|
+
|
99
|
+
time.sleep(0.1)
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
w.digitalWrite(cs_pin, 0)
|
104
|
+
|
105
|
+
time.sleep(0.1)
|
106
|
+
|
95
107
|
adc = spi.xfer2(send_data)
|
108
|
+
|
109
|
+
w.digitalWrite(cs_pin, 1)
|
110
|
+
|
111
|
+
|
96
112
|
|
97
113
|
adc_value = adc[0] << 8 | adc[1]
|
98
114
|
|
99
115
|
print('CH:%d %d' % (channel, adc_value))
|
100
116
|
|
101
|
-
|
117
|
+
|
102
118
|
|
103
|
-
|
119
|
+
return adc_value
|
104
120
|
|
105
121
|
|
106
122
|
|