Allright. SO I've been trying to find a solution to this problem, but can't seem to fix it. I am using the sparkfun MAX30105 particle sensor. I recently changed over from windows to linux, so i just copied all of the libraries from windows. I have attached the code and all my libraries.
The error message I'm getting:
Multiple libraries were found for "Wire.h"
HeartRate_monitor:2:10: error: heartRate.h: No such file or directory
Used: /home/durand/Documents/Arduino/arduino-1.8.10/hardware/arduino/avr/libraries/Wire
#include "heartRate.h"
^~~~~~~~~~~~~
compilation terminated.
exit status 1
heartRate.h: No such file or directory
My code in case you want it:
#include <Wire.h>
#include "heartRate.h"
#include "MAX30105.h"
#include <SPI.h>
#include <SD.h>
MAX30105 particleSensor;
const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;
const int chipSelect = 4;
String dataString = "";
void setup()
{
Serial.begin(115200);
Serial.println("Initializing...");
// Initialize sensor
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
while (1);
}
Serial.println("Place your index finger on the sensor with steady pressure.");
particleSensor.setup(); //Configure sensor with default settings
particleSensor.setPulseAmplitudeRed(0x0A); //Turn Red LED to low to indicate sensor is running
particleSensor.setPulseAmplitudeGreen(0); //Turn off Green LED
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
while (1);
}
SD.remove("datalog.txt");
delay (3000);
}
void loop() {
Heart_rate();
delay(30);
SD_save();
}
void Heart_rate()
{
long irValue = particleSensor.getIR();
if (checkForBeat(irValue) == true)
{
//We sensed a beat!
long delta = millis() - lastBeat;
lastBeat = millis();
beatsPerMinute = 60 / (delta / 1000.0);
if (beatsPerMinute < 255 && beatsPerMinute > 20)
{
rates[rateSpot++] = (byte)beatsPerMinute; //Store this reading in the array
rateSpot %= RATE_SIZE; //Wrap variable
//Take average of readings
beatAvg = 0;
for (byte x = 0 ; x < RATE_SIZE ; x++)
beatAvg += rates[x];
beatAvg /= RATE_SIZE;
}
}
Serial.print("IR=");
Serial.print(irValue);
Serial.print(", BPM=");
Serial.print(beatsPerMinute);
Serial.print(", Avg BPM=");
Serial.print(beatAvg);
dataString += (irValue);
dataString += (",");
dataString += (beatsPerMinute);
dataString += (",");
dataString += (beatAvg);
dataString += (",");
if (irValue < 50000){
Serial.print('0');
dataString += ('0');
}
Serial.print('1');
dataString += ('1');
Serial.println();
delay(10);
}
void SD_save() {
File dataFile = SD.open("datalog.txt", FILE_WRITE);
if (dataFile) {
dataFile.println(dataString);
dataFile.close();
// print to the serial port too:
Serial.println(dataString);
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening datalog.txt");
}
dataString = "";
}
I'm using Arduno 1.8.10
Thank you for your time!!
UPDATE
I've fixed the previous issues, but now i have another problem
This is the error I get now:
fork/exec /bin/arm-none-eabi-g++: no such file or directory
Error compiling for board Adafruit Feather M0.
Does anyone know how to fix this?
I'm on Linux Mint Mate.
Any and all help is appreciated.