Ошибка компиляции для платы Arduino/Genuino Uno. exit status 1
- Войдите на сайт для отправки комментариев
Ср, 06/02/2019 - 14:34
Хочу подключить датчик пульса вместе с другими датчиками и вылазит ошибка exit status 1. Если подключить датчик на отдельную плату и написать код только для него, тогда всё нормально работает, а в паре с другими модулями не компилируется.
ВОТ СООБЩЕНИЕ ОБ ОШИБКЕ:
Arduino: 1.8.8 (Windows 10), Плата:"Arduino/Genuino Uno"
C:\Users\vladm\AppData\Local\Temp\ccaxEETh.ltrans0.ltrans.o: In function `begin':
C:\Users\vladm\OneDrive\Документы\Arduino\libraries\PulseSensorPlayground-
master\src/PulseSensorPlayground.cpp:55: undefined reference to `PulseSensorPlayground::UsingInterrupts'
C:\Users\vladm\OneDrive\Документы\Arduino\libraries\PulseSensorPlayground-master\src/PulseSensorPlayground.cpp:56: undefined reference to `PulseSensorPlaygroundSetupInterrupt()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Ошибка компиляции для платы Arduino/Genuino Uno.
ВОТ КОД СО ВСЕМИ МОДУЛЯМИ:
#include <NewPing.h> #include <OneWire.h> #include <DallasTemperature.h> #include <LiquidCrystal_I2C.h> #include <PulseSensorPlayground.h> #define USE_ARDUINO_INTERRUPTS true #define PulseWire A2 int Threshold = 550; #define red 12 #define green 11 #define blue 13 #define buzzerPin 6 #define trigPin 9 #define echoPin A0 NewPing sonar(trigPin, echoPin, 200); OneWire oneWire(15); // вход датчиков 18b20, аналоговый А1, он же 15 цифровой DallasTemperature ds(&oneWire); LiquidCrystal_I2C lcd(0x27,16,2); PulseSensorPlayground pulseSensor; void setup() { Serial.begin(9600); lcd.init(); lcd.backlight(); ds.begin(); pinMode(trigPin,OUTPUT); pinMode(echoPin,INPUT); pinMode(red,OUTPUT); pinMode(green,OUTPUT); pinMode(blue,OUTPUT); pulseSensor.analogInput(PulseWire); pulseSensor.setThreshold(Threshold); if (pulseSensor.begin()) { Serial.println("We created a pulseSensor Object !"); } } void loop() { analogWrite(buzzerPin, 0); for(int timers = 330; timers > 0; --timers){ if(timers >= 10) { lcd.setCursor(9,0); } else { lcd.setCursor(9,0); lcd.print("0"); lcd.setCursor(10,0); } int distance = sonar.ping_cm(); Serial.println(distance); if(distance < 45 && distance > 10){ digitalWrite(red, HIGH); digitalWrite(green, LOW); digitalWrite(blue, LOW); //delay(2000); } else { digitalWrite(red, LOW); digitalWrite(green, HIGH); digitalWrite(blue, LOW); //delay(2000); } lcd.print(timers); lcd.print(" sec"); lcd.setCursor(0,0); int myBPM = pulseSensor.getBeatsPerMinute(); if (pulseSensor.sawStartOfBeat()) { lcd.print("BPM:"); lcd.print(myBPM); } lcd.setCursor(0, 1); ds.requestTemperatures(); // считываем температуру с датчиков, на это требуется 750мс lcd.print("Temp: "); lcd.print(ds.getTempCByIndex(0) + 0.58); // отправляем температуру delay(250); } lcd.setCursor(0,0); lcd.clear(); lcd.print(" TIMER ALERT!"); analogWrite(buzzerPin, 150); delay(1500); analogWrite(buzzerPin, 0); delay(4000); lcd.clear(); }
Для начала выполните эту инструкцию из библиотеки:
NOTE: Every Sketch that uses the PulseSensor Playground
must define the variable USE_ARDUINO_INTERRUPTS *before* including
PulseSensorPlayground.h. If you don't, you will get a compiler error
about "undefined reference to `PulseSensorPlayground::UsingInterrupts".
In particular, if your Sketch wants the Playground to use interrupts
to read and process PulseSensor data, your Sketch must contain the
following two lines, in order:
#define USE_ARDUINO_INTERRUPTS true
#include <PulseSensorPlayground.h>
If, instead, your Sketch does not use interrupts to read PulseSensor
data, your Sketch must instead contain the
following two lines, in order:
#define USE_ARDUINO_INTERRUPTS false
#include <PulseSensorPlayground.h>