質問編集履歴

1

2回のデータ送信の間にCSを一度Hに戻す操作を加えてた

2021/03/19 04:13

投稿

YOshim
YOshim

スコア1085

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
-     w.digitalWrite(cs_pin, 0)
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
-     w.digitalWrite(cs_pin, 1)
117
+    
102
118
 
103
-     return adc_value
119
+ return adc_value
104
120
 
105
121
 
106
122