質問編集履歴
2
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,145 +1 @@
|
|
1
|
-
bitalinoからpythonにつないでいるのですが、
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
```python
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
import time
|
10
|
-
|
11
|
-
from bitalino import BITalino
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# The macAddress variable on Windows can be "XX:XX:XX:XX:XX:XX" or "COMX"
|
18
|
-
|
19
|
-
# while on Mac OS can be "/dev/tty.BITalino-XX-XX-DevB" for devices ending with the last 4 digits of the MAC address or "/dev/tty.BITalino-DevB" for the remaining
|
20
|
-
|
21
|
-
macAddress = "98:D3:A1:FD:5B:E8"
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# This example will collect data for 5 sec.
|
26
|
-
|
27
|
-
running_time = 1
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
batteryThreshold = 30
|
32
|
-
|
33
|
-
acqChannels = [0 ,1 ,2 ,3 , 4, 5]
|
34
|
-
|
35
|
-
samplingRate = 1000
|
36
|
-
|
37
|
-
nSamples = 10
|
38
|
-
|
39
|
-
digitalOutput = [1,1]
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# Connect to BITalino
|
44
|
-
|
45
|
-
device = BITalino(macAddress)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
# Set battery threshold
|
50
|
-
|
51
|
-
device.battery(batteryThreshold)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
# Read BITalino version
|
56
|
-
|
57
|
-
print(device.version())
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
# Start Acquisition
|
62
|
-
|
63
|
-
|
1
|
+
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
start = time.time()
|
68
|
-
|
69
|
-
end = time.time()
|
70
|
-
|
71
|
-
while (end - start) < running_time:
|
72
|
-
|
73
|
-
# Read samples
|
74
|
-
|
75
|
-
print(device.read(nSamples))
|
76
|
-
|
77
|
-
end = time.time()
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
# Turn BITalino led on
|
84
|
-
|
85
|
-
device.trigger(digitalOutput)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
# Stop acquisition
|
90
|
-
|
91
|
-
device.stop()
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
# Close connection
|
96
|
-
|
97
|
-
device.close()
|
98
|
-
|
99
|
-
```
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
このプログラムを実行すると
|
104
|
-
|
105
|
-
[[ 0. 1. 1. 1. 1. 0. 0. 528. 2. 0. 0.]
|
106
|
-
|
107
|
-
[ 1. 1. 1. 1. 1. 0. 0. 529. 2. 0. 0.]
|
108
|
-
|
109
|
-
[ 2. 1. 1. 1. 1. 0. 0. 519. 4. 0. 0.]
|
110
|
-
|
111
|
-
[ 3. 1. 1. 1. 1. 0. 0. 499. 2. 0. 0.]
|
112
|
-
|
113
|
-
[ 4. 1. 1. 1. 1. 1. 1. 488. 2. 0. 0.]
|
114
|
-
|
115
|
-
[ 5. 1. 1. 1. 1. 4. 0. 486. 1. 0. 0.]
|
116
|
-
|
117
|
-
[ 6. 1. 1. 1. 1. 0. 0. 478. 0. 0. 0.]
|
118
|
-
|
119
|
-
[ 7. 1. 1. 1. 1. 0. 0. 492. 2. 0. 0.]
|
120
|
-
|
121
|
-
[ 8. 1. 1. 1. 1. 0. 0. 504. 2. 0. 0.]
|
122
|
-
|
123
|
-
[ 9. 1. 1. 1. 1. 0. 0. 506. 2. 0. 0.]]
|
124
|
-
|
125
|
-
[[ 10. 1. 1. 1. 1. 0. 0. 508. 4. 0. 0.]
|
126
|
-
|
127
|
-
[ 11. 1. 1. 1. 1. 0. 0. 514. 2. 0. 0.]
|
128
|
-
|
129
|
-
[ 12. 1. 1. 1. 1. 1. 1. 517. 2. 0. 0.]
|
130
|
-
|
131
|
-
[ 13. 1. 1. 1. 1. 4. 0. 515. 2. 0. 0.]
|
132
|
-
|
133
|
-
[ 14. 1. 1. 1. 1. 0. 0. 524. 0. 0. 0.]
|
134
|
-
|
135
|
-
[ 15. 1. 1. 1. 1. 0. 0. 515. 2. 0. 0.]
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
上記のような結果が出てきます
|
140
|
-
|
141
|
-
そこで,8列目の500~だけを抽出し,PCに保存したいのですが、
|
142
|
-
|
143
|
-
プログラムをどう変えればいいかわかりません。
|
144
|
-
|
145
|
-
乱文になりましたが、ご教授いただければ幸いです。
|
1
codeを読み取りやすくしました.よろしくお願いします.
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
bitalinoからpythonにつないでいるのですが、
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```python
|
2
6
|
|
3
7
|
|
4
8
|
|
@@ -92,6 +96,8 @@
|
|
92
96
|
|
93
97
|
device.close()
|
94
98
|
|
99
|
+
```
|
100
|
+
|
95
101
|
|
96
102
|
|
97
103
|
このプログラムを実行すると
|