質問編集履歴
3
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -502,13 +502,13 @@
|
|
502
502
|
|
503
503
|
sketch/BME280_MOD-1022.h:41:21: warning: extra tokens at end of #ifndef directive
|
504
504
|
|
505
|
-
|
505
|
+
#ifndef __BME280_MOD-1022_H
|
506
506
|
|
507
507
|
^
|
508
508
|
|
509
509
|
sketch/BME280_MOD-1022.h:42:21: warning: ISO C99 requires whitespace after the macro name
|
510
510
|
|
511
|
-
|
511
|
+
#define __BME280_MOD-1022_H
|
512
512
|
|
513
513
|
^
|
514
514
|
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -494,7 +494,7 @@
|
|
494
494
|
|
495
495
|
するとこの様なエラー文が表示されました。
|
496
496
|
|
497
|
-
|
497
|
+
Arduino:1.8.5 (Mac OS X), ボード:"Arduino Nano, ATmega328P"
|
498
498
|
|
499
499
|
|
500
500
|
|
1
誤字、追加
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
BME280で取得した数値によってLEDの出力を変えたい(言語:C)
|
test
CHANGED
@@ -1,10 +1,220 @@
|
|
1
|
+
Arduino nanoとBME280、そしてC言語を使って、電子おもちゃを作ろうとしております。
|
2
|
+
|
3
|
+
動作としては、BME280で得た気温の数値によってLEDの光り方を変化させるというものです。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
それを作るべくC言語をいろいろ編集していたところ、IF文の作成のところで躓いてしまいました。
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
最初、BME280から気温等をインプットし、シリアルモニタに出力するコードを作りました。
|
14
|
+
|
15
|
+
そして、無事出力できました。
|
16
|
+
|
17
|
+
```C
|
18
|
+
|
19
|
+
void printFormattedFloat(float x, uint8_t precision) {
|
20
|
+
|
21
|
+
char buffer[10];
|
22
|
+
|
23
|
+
dtostrf(x, 7, precision, buffer);
|
24
|
+
|
25
|
+
Serial.print(buffer);
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
// print out the measurements
|
32
|
+
|
33
|
+
void printCompensatedMeasurements(void) {
|
34
|
+
|
35
|
+
float temp, humidity, pressure, pressureMoreAccurate;
|
36
|
+
|
37
|
+
double tempMostAccurate, humidityMostAccurate, pressureMostAccurate;
|
38
|
+
|
39
|
+
char buffer[80];
|
40
|
+
|
41
|
+
temp = BME280.getTemperature();
|
42
|
+
|
43
|
+
humidity = BME280.getHumidity();
|
44
|
+
|
45
|
+
pressure = BME280.getPressure();
|
46
|
+
|
47
|
+
pressureMoreAccurate = BME280.getPressureMoreAccurate();
|
48
|
+
|
49
|
+
tempMostAccurate = BME280.getTemperatureMostAccurate();
|
50
|
+
|
51
|
+
humidityMostAccurate = BME280.getHumidityMostAccurate();
|
52
|
+
|
53
|
+
pressureMostAccurate = BME280.getPressureMostAccurate();
|
54
|
+
|
55
|
+
printFormattedFloat(tempMostAccurate, 2);
|
56
|
+
|
57
|
+
Serial.print(" ");
|
58
|
+
|
59
|
+
printFormattedFloat(humidityMostAccurate, 2);
|
60
|
+
|
61
|
+
Serial.print(" ");
|
62
|
+
|
63
|
+
printFormattedFloat(pressureMostAccurate, 2);
|
64
|
+
|
65
|
+
Serial.println();
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
// setup wire and serial
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
void setup()
|
78
|
+
|
79
|
+
{
|
80
|
+
|
81
|
+
Wire.begin();
|
82
|
+
|
83
|
+
Serial.begin(9600);
|
84
|
+
|
85
|
+
pinMode(16,INPUT);
|
86
|
+
|
87
|
+
pinMode(17,OUTPUT);
|
88
|
+
|
89
|
+
digitalWrite(17,0);
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
// main loop
|
96
|
+
|
97
|
+
void loop()
|
98
|
+
|
99
|
+
{
|
100
|
+
|
101
|
+
uint8_t chipID;
|
102
|
+
|
103
|
+
chipID = BME280.readChipId();
|
104
|
+
|
105
|
+
Serial.print("ChipID = 0x");
|
106
|
+
|
107
|
+
Serial.print(chipID, HEX);
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
// need to read the NVM compensation parameters
|
112
|
+
|
113
|
+
BME280.readCompensationParams();
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
BME280.writeOversamplingPressure(os1x);
|
118
|
+
|
119
|
+
BME280.writeOversamplingTemperature(os1x);
|
120
|
+
|
121
|
+
BME280.writeOversamplingHumidity(os1x);
|
122
|
+
|
123
|
+
|
124
|
+
|
1
|
-
|
125
|
+
BME280.writeMode(smForced);
|
126
|
+
|
2
|
-
|
127
|
+
while (BME280.isMeasuring()) {
|
128
|
+
|
129
|
+
Serial.println("Measuring...");
|
130
|
+
|
131
|
+
delay(50);
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
Serial.println("Done!");
|
136
|
+
|
137
|
+
// read out the data - must do this before calling the getxxxxx routines
|
138
|
+
|
139
|
+
BME280.readMeasurements();
|
140
|
+
|
141
|
+
Serial.print("Temp=");
|
142
|
+
|
143
|
+
Serial.println(BME280.getTemperature()); // must get temp first
|
144
|
+
|
145
|
+
Serial.print("Humidity=");
|
146
|
+
|
147
|
+
Serial.println(BME280.getHumidity());
|
148
|
+
|
3
|
-
i
|
149
|
+
Serial.print("Pressure=");
|
150
|
+
|
4
|
-
|
151
|
+
Serial.println(BME280.getPressure());
|
152
|
+
|
153
|
+
Serial.print("PressureMoreAccurate=");
|
154
|
+
|
155
|
+
Serial.println(BME280.getPressureMoreAccurate()); // use int64 calculcations
|
156
|
+
|
157
|
+
Serial.print("TempMostAccurate=");
|
158
|
+
|
159
|
+
Serial.println(BME280.getTemperatureMostAccurate()); // use double calculations
|
160
|
+
|
161
|
+
Serial.print("HumidityMostAccurate=");
|
162
|
+
|
163
|
+
Serial.println(BME280.getHumidityMostAccurate()); // use double calculations
|
164
|
+
|
165
|
+
Serial.print("PressureMostAccurate=");
|
166
|
+
|
167
|
+
Serial.println(BME280.getPressureMostAccurate()); // use double calculations
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
// Example for "indoor navigation"
|
172
|
+
|
173
|
+
// We'll switch into normal mode for regular automatic samples
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
BME280.writeStandbyTime(tsb_0p5ms); // tsb = 0.5ms
|
178
|
+
|
179
|
+
BME280.writeFilterCoefficient(fc_16); // IIR Filter coefficient 16
|
180
|
+
|
181
|
+
BME280.writeOversamplingPressure(os16x); // pressure x16
|
182
|
+
|
183
|
+
BME280.writeOversamplingTemperature(os2x); // temperature x2
|
184
|
+
|
185
|
+
BME280.writeOversamplingHumidity(os1x); // humidity x1
|
186
|
+
|
187
|
+
BME280.writeMode(smNormal);
|
188
|
+
|
189
|
+
|
190
|
+
|
5
|
-
|
191
|
+
while (1) {
|
192
|
+
|
6
|
-
|
193
|
+
while (BME280.isMeasuring()) {
|
194
|
+
|
7
|
-
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
// read out the data - must do this before calling the getxxxxx routines
|
200
|
+
|
201
|
+
BME280.readMeasurements();
|
202
|
+
|
203
|
+
printCompensatedMeasurements();
|
204
|
+
|
205
|
+
delay(1000); // do this every 5 seconds
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
```
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
そしてその後、if文を追加しました。そのコードが以下となります。
|
216
|
+
|
217
|
+
```C
|
8
218
|
|
9
219
|
#include "BME280_MOD-1022.h"
|
10
220
|
|
@@ -16,9 +226,9 @@
|
|
16
226
|
|
17
227
|
char buffer[10];
|
18
228
|
|
19
|
-
dtostrf(x, 7, precision, buffer);
|
229
|
+
dtostrf(x, 7, precision, buffer);
|
20
|
-
|
230
|
+
|
21
|
-
Serial.print(buffer);
|
231
|
+
Serial.print(buffer);
|
22
232
|
|
23
233
|
}
|
24
234
|
|
@@ -34,43 +244,43 @@
|
|
34
244
|
|
35
245
|
char buffer[80];
|
36
246
|
|
37
|
-
temp = BME280.getTemperature();
|
247
|
+
temp = BME280.getTemperature();
|
38
|
-
|
248
|
+
|
39
|
-
humidity = BME280.getHumidity();
|
249
|
+
humidity = BME280.getHumidity();
|
40
|
-
|
250
|
+
|
41
|
-
pressure = BME280.getPressure();
|
251
|
+
pressure = BME280.getPressure();
|
42
|
-
|
252
|
+
|
43
|
-
pressureMoreAccurate = BME280.getPressureMoreAccurate();
|
253
|
+
pressureMoreAccurate = BME280.getPressureMoreAccurate();
|
44
|
-
|
254
|
+
|
45
|
-
tempMostAccurate = BME280.getTemperatureMostAccurate();
|
255
|
+
tempMostAccurate = BME280.getTemperatureMostAccurate();
|
46
|
-
|
256
|
+
|
47
|
-
humidityMostAccurate = BME280.getHumidityMostAccurate();
|
257
|
+
humidityMostAccurate = BME280.getHumidityMostAccurate();
|
48
|
-
|
258
|
+
|
49
|
-
pressureMostAccurate = BME280.getPressureMostAccurate();
|
259
|
+
pressureMostAccurate = BME280.getPressureMostAccurate();
|
50
|
-
|
260
|
+
|
51
|
-
printFormattedFloat(tempMostAccurate, 2);
|
261
|
+
printFormattedFloat(tempMostAccurate, 2);
|
52
|
-
|
262
|
+
|
53
|
-
Serial.print(" ");
|
263
|
+
Serial.print(" ");
|
54
|
-
|
264
|
+
|
55
|
-
printFormattedFloat(humidityMostAccurate, 2);
|
265
|
+
printFormattedFloat(humidityMostAccurate, 2);
|
56
|
-
|
266
|
+
|
57
|
-
Serial.print(" ");
|
267
|
+
Serial.print(" ");
|
58
|
-
|
268
|
+
|
59
|
-
printFormattedFloat(pressureMostAccurate, 2);
|
269
|
+
printFormattedFloat(pressureMostAccurate, 2);
|
60
|
-
|
270
|
+
|
61
|
-
Serial.println();
|
271
|
+
Serial.println();
|
272
|
+
|
62
|
-
|
273
|
+
}
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
// ここにLEDの変数を追加しました。
|
278
|
+
|
63
|
-
|
279
|
+
int ledPin1;
|
64
|
-
|
280
|
+
|
65
|
-
|
281
|
+
int ledPin2;
|
66
|
-
|
282
|
+
|
67
|
-
|
283
|
+
int ledPin3;
|
68
|
-
|
69
|
-
}
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
284
|
|
75
285
|
|
76
286
|
|
@@ -84,31 +294,29 @@
|
|
84
294
|
|
85
295
|
{
|
86
296
|
|
87
|
-
Wire.begin();
|
297
|
+
Wire.begin();
|
88
|
-
|
298
|
+
|
89
|
-
Serial.begin(9600);
|
299
|
+
Serial.begin(9600);
|
90
|
-
|
300
|
+
|
91
|
-
pinMode(16,INPUT);
|
301
|
+
pinMode(16,INPUT);
|
92
|
-
|
302
|
+
|
93
|
-
pinMode(ledPin1,OUTPUT);
|
303
|
+
pinMode(ledPin1,OUTPUT);
|
94
|
-
|
304
|
+
|
95
|
-
pinMode(ledPin2,OUTPUT);
|
305
|
+
pinMode(ledPin2,OUTPUT);
|
96
|
-
|
306
|
+
|
97
|
-
pinMode(ledPin3,OUTPUT);
|
307
|
+
pinMode(ledPin3,OUTPUT);
|
98
|
-
|
308
|
+
|
99
|
-
digitalWrite(17,0);
|
309
|
+
digitalWrite(17,0);
|
310
|
+
|
311
|
+
|
312
|
+
|
100
|
-
|
313
|
+
// それぞれの番号の場所に刺す様にしました。
|
101
|
-
|
102
|
-
|
314
|
+
|
103
|
-
ledPin1=9;
|
315
|
+
ledPin1=9;
|
104
|
-
|
316
|
+
|
105
|
-
ledPin2=6;
|
317
|
+
ledPin2=6;
|
106
|
-
|
318
|
+
|
107
|
-
ledPin3=3;
|
319
|
+
ledPin3=3;
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
320
|
|
113
321
|
}
|
114
322
|
|
@@ -120,152 +328,218 @@
|
|
120
328
|
|
121
329
|
{
|
122
330
|
|
123
|
-
uint8_t chipID;
|
124
|
-
|
125
|
-
chipID = BME280.readChipId();
|
126
|
-
|
127
|
-
Serial.print("ChipID = 0x");
|
128
|
-
|
129
|
-
Serial.print(chipID, HEX);
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
// need to read the NVM compensation parameters
|
134
|
-
|
135
|
-
BME280.readCompensationParams();
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
BME280.writeOversamplingPressure(os1x);
|
140
|
-
|
141
|
-
BME280.writeOversamplingTemperature(os1x);
|
142
|
-
|
143
|
-
BME280.writeOversamplingHumidity(os1x);
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
BME280.writeMode(smForced);
|
148
|
-
|
149
|
-
while (BME280.isMeasuring()) {
|
150
|
-
|
151
|
-
Serial.println("Measuring...");
|
152
|
-
|
153
|
-
delay(50);
|
154
|
-
|
155
|
-
}
|
156
|
-
|
157
|
-
Serial.println("Done!");
|
158
|
-
|
159
|
-
// read out the data - must do this before calling the getxxxxx routines
|
160
|
-
|
161
|
-
BME280.readMeasurements();
|
162
|
-
|
163
|
-
Serial.print("Temp=");
|
164
|
-
|
165
|
-
Serial.println(BME280.getTemperature()); // must get temp first
|
166
|
-
|
167
|
-
Serial.print("Humidity=");
|
168
|
-
|
169
|
-
Serial.println(BME280.getHumidity());
|
170
|
-
|
171
|
-
Serial.print("Pressure=");
|
172
|
-
|
173
|
-
Serial.println(BME280.getPressure());
|
174
|
-
|
175
|
-
Serial.print("PressureMoreAccurate=");
|
176
|
-
|
177
|
-
Serial.println(BME280.getPressureMoreAccurate()); // use int64 calculcations
|
178
|
-
|
179
|
-
Serial.print("TempMostAccurate=");
|
180
|
-
|
181
|
-
Serial.println(BME280.getTemperatureMostAccurate()); // use double calculations
|
182
|
-
|
183
|
-
Serial.print("HumidityMostAccurate=");
|
184
|
-
|
185
|
-
Serial.println(BME280.getHumidityMostAccurate()); // use double calculations
|
186
|
-
|
187
|
-
Serial.print("PressureMostAccurate=");
|
188
|
-
|
189
|
-
Serial.println(BME280.getPressureMostAccurate()); // use double calculations
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
digitalWrite(ledPin
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
el
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
digitalWrite(ledPin
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
BME280.write
|
250
|
-
|
251
|
-
BME280.write
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
w
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
BME280.
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
331
|
+
uint8_t chipID;
|
332
|
+
|
333
|
+
chipID = BME280.readChipId();
|
334
|
+
|
335
|
+
Serial.print("ChipID = 0x");
|
336
|
+
|
337
|
+
Serial.print(chipID, HEX);
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
// need to read the NVM compensation parameters
|
342
|
+
|
343
|
+
BME280.readCompensationParams();
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
BME280.writeOversamplingPressure(os1x);
|
348
|
+
|
349
|
+
BME280.writeOversamplingTemperature(os1x);
|
350
|
+
|
351
|
+
BME280.writeOversamplingHumidity(os1x);
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
BME280.writeMode(smForced);
|
356
|
+
|
357
|
+
while (BME280.isMeasuring()) {
|
358
|
+
|
359
|
+
Serial.println("Measuring...");
|
360
|
+
|
361
|
+
delay(50);
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
Serial.println("Done!");
|
366
|
+
|
367
|
+
// read out the data - must do this before calling the getxxxxx routines
|
368
|
+
|
369
|
+
BME280.readMeasurements();
|
370
|
+
|
371
|
+
Serial.print("Temp=");
|
372
|
+
|
373
|
+
Serial.println(BME280.getTemperature()); // must get temp first
|
374
|
+
|
375
|
+
Serial.print("Humidity=");
|
376
|
+
|
377
|
+
Serial.println(BME280.getHumidity());
|
378
|
+
|
379
|
+
Serial.print("Pressure=");
|
380
|
+
|
381
|
+
Serial.println(BME280.getPressure());
|
382
|
+
|
383
|
+
Serial.print("PressureMoreAccurate=");
|
384
|
+
|
385
|
+
Serial.println(BME280.getPressureMoreAccurate()); // use int64 calculcations
|
386
|
+
|
387
|
+
Serial.print("TempMostAccurate=");
|
388
|
+
|
389
|
+
Serial.println(BME280.getTemperatureMostAccurate()); // use double calculations
|
390
|
+
|
391
|
+
Serial.print("HumidityMostAccurate=");
|
392
|
+
|
393
|
+
Serial.println(BME280.getHumidityMostAccurate()); // use double calculations
|
394
|
+
|
395
|
+
Serial.print("PressureMostAccurate=");
|
396
|
+
|
397
|
+
Serial.println(BME280.getPressureMostAccurate()); // use double calculations
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
// ここに変数を指定しました。
|
404
|
+
|
405
|
+
int tempe
|
406
|
+
|
407
|
+
tempe = BME280.getTemperature()
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
// ここにif文を追加しました。
|
412
|
+
|
413
|
+
if(tempe>=20&&tempe<25)
|
414
|
+
|
415
|
+
{
|
416
|
+
|
417
|
+
digitalWrite(ledPin1,1);
|
418
|
+
|
419
|
+
delay(1000);
|
420
|
+
|
421
|
+
digitalWrite(ledPin1,0);
|
422
|
+
|
423
|
+
}
|
424
|
+
|
425
|
+
else if(tempe>=25&&tempe<30)
|
426
|
+
|
427
|
+
{
|
428
|
+
|
429
|
+
digitalWrite(ledPin2,1);
|
430
|
+
|
431
|
+
delay(1000);
|
432
|
+
|
433
|
+
digitalWrite(ledPin2,0);
|
434
|
+
|
435
|
+
}
|
436
|
+
|
437
|
+
else if(tempe>=30)
|
438
|
+
|
439
|
+
{
|
440
|
+
|
441
|
+
digitalWrite(ledPin3,1);
|
442
|
+
|
443
|
+
delay(1000);
|
444
|
+
|
445
|
+
digitalWrite(ledPin3,0);
|
446
|
+
|
447
|
+
}
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
// Example for "indoor navigation"
|
452
|
+
|
453
|
+
// We'll switch into normal mode for regular automatic samples
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
BME280.writeStandbyTime(tsb_0p5ms); // tsb = 0.5ms
|
458
|
+
|
459
|
+
BME280.writeFilterCoefficient(fc_16); // IIR Filter coefficient 16
|
460
|
+
|
461
|
+
BME280.writeOversamplingPressure(os16x); // pressure x16
|
462
|
+
|
463
|
+
BME280.writeOversamplingTemperature(os2x); // temperature x2
|
464
|
+
|
465
|
+
BME280.writeOversamplingHumidity(os1x); // humidity x1
|
466
|
+
|
467
|
+
BME280.writeMode(smNormal);
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
while (1) {
|
472
|
+
|
473
|
+
while (BME280.isMeasuring()) {
|
474
|
+
|
475
|
+
}
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
// read out the data - must do this before calling the getxxxxx routines
|
480
|
+
|
481
|
+
BME280.readMeasurements();
|
482
|
+
|
483
|
+
printCompensatedMeasurements();
|
484
|
+
|
485
|
+
delay(1000); // do this every 5 seconds
|
486
|
+
|
487
|
+
}
|
488
|
+
|
489
|
+
}
|
490
|
+
|
491
|
+
```
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
するとこの様なエラー文が表示されました。
|
496
|
+
|
497
|
+
> Arduino:1.8.5 (Mac OS X), ボード:"Arduino Nano, ATmega328P"
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
In file included from /Users/KaishuYanagida/Desktop/sfc/おもちゃWS/bme280/bme280.ino:1:0:
|
502
|
+
|
503
|
+
sketch/BME280_MOD-1022.h:41:21: warning: extra tokens at end of #ifndef directive
|
504
|
+
|
505
|
+
#ifndef __BME280_MOD-1022_H
|
506
|
+
|
507
|
+
^
|
508
|
+
|
509
|
+
sketch/BME280_MOD-1022.h:42:21: warning: ISO C99 requires whitespace after the macro name
|
510
|
+
|
511
|
+
#define __BME280_MOD-1022_H
|
512
|
+
|
513
|
+
^
|
514
|
+
|
515
|
+
/Users/KaishuYanagida/Desktop/sfc/おもちゃWS/bme280/bme280.ino: In function 'void loop()':
|
516
|
+
|
517
|
+
bme280:94: error: expected initializer before 'tempe'
|
518
|
+
|
519
|
+
tempe = BME280.getTemperature()
|
520
|
+
|
521
|
+
^
|
522
|
+
|
523
|
+
bme280:102: error: 'else' without a previous 'if'
|
524
|
+
|
525
|
+
else if(tempe>=25&&tempe<30)
|
526
|
+
|
527
|
+
^
|
528
|
+
|
529
|
+
bme280:102: error: 'tempe' was not declared in this scope
|
530
|
+
|
531
|
+
else if(tempe>=25&&tempe<30)
|
532
|
+
|
533
|
+
^
|
534
|
+
|
535
|
+
exit status 1
|
536
|
+
|
537
|
+
expected initializer before 'tempe'
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
私がやりたいことは上にも書いた通り、BME280で取得した値によってLEDの出力を変えるというものです。
|
544
|
+
|
545
|
+
至らない点が多いですが回答よろしくお願いします。
|