oxullo / Arduino-MAX30100

Arduino library for MAX30100, integrated oximeter and heart rate sensor
GNU General Public License v3.0
190 stars 134 forks source link

Could not convery from void to bool #55

Closed danelpo closed 5 years ago

danelpo commented 5 years ago

Troubleshooting checklist

Description of the issue

When I put the example code in, it highlights the line where it checked if pox has begun: if (!pox.begin()) { Serial.println("FAILED"); for(;;); } else { Serial.println("SUCCESS"); } and the message is:

Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno"

MAX30100_Minimal:48:19: error: could not convert 'pox.PulseOximeter::begin((PulseOximeterDebuggingMode)0u)' from 'void' to 'bool'

 if (!pox.begin()) {

               ^

MAX30100_Minimal:48:20: error: in argument to unary !

 if (!pox.begin()) {

                ^

Multiple libraries were found for "MAX30100_PulseOximeter.h" Used: C:\Users\Documents\Arduino\libraries\MAX30100 Not used: C:\Users\danel\Documents\Arduino\libraries\Arduino-MAX30100-master Not used: C:\Users\danel\Documents\Arduino\libraries\Arduino-MAX30100-master Not used: C:\Users\danel\Documents\Arduino\libraries\Arduino-MAX30100-master Not used: C:\Users\danel\Documents\Arduino\libraries\Arduino-MAX30100-master exit status 1 could not convert 'pox.PulseOximeter::begin((PulseOximeterDebuggingMode)0u)' from 'void' to 'bool'

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

If I were to comment that part out it will not even turn the LED on and the HR would be 0.

Details of my setup

I have the MAX30100 plugged into 3.3v (I also tried 5) and ground, pin SCL connected intoA5, pin SDA into A4 and INT into 2.

Jivansha commented 5 years ago

Hey! Please use 4.7k pull up resistors in parallel with SCL and SDA to avoid any I2C errors later. Also, there shouldn't be a problem if you have included all the libraries of MAX30100 and initialised the sensor properly before using pox.begin() command. Try looking into the examples of this library and if the problem persists please share the complete code.

oxullo commented 5 years ago

@danelpo as @Jivansha suggested, it might be a missing include. I trust that you installed the library using the library manager and loaded the examples using the arduino's menu under File->Examples.

I'm closing the issue since I cannot reproduce it.