質問編集履歴
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -66,6 +66,104 @@
|
|
66
66
|
|
67
67
|
|
68
68
|
|
69
|
+
###Unityのコード
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
```ここに言語を入力
|
74
|
+
|
75
|
+
using UnityEngine;
|
76
|
+
|
77
|
+
using System.IO.Ports;
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
public class SerialTest : MonoBehaviour
|
82
|
+
|
83
|
+
{
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
SerialPort serialPort;
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
void Start()
|
92
|
+
|
93
|
+
{
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
serialPort = new SerialPort("COM13", 9600);
|
98
|
+
|
99
|
+
serialPort.Open();
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
void OnGUI()
|
108
|
+
|
109
|
+
{
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
GUILayout.Label(serialPort.ReadLine());
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
###Arduinoのコード
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
```ここに言語を入力
|
132
|
+
|
133
|
+
const int AnalogPin = A0;
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
void setup() {
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
Serial.begin(9600);
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
void loop() {
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
Serial.println(analogRead(AnalogPin));
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
delay(100);
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
|
166
|
+
|
69
167
|
|
70
168
|
|
71
169
|
###配線の画像
|