# Integrating the MAXREFDES117 with the micro:bit (C++)

**URL:** <https://forum.makecode.com/t/integrating-the-maxrefdes117-with-the-micro-bit-c/14328>\
**Category:** micro:bit\
**Created:** [July 5, 2022, 5:12pm UTC](https://forum.makecode.com/t/integrating-the-maxrefdes117-with-the-micro-bit-c/14328 "2022-07-05T17:12:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![usultonov\_b18](https://avatars.discourse-cdn.com/v4/letter/u/34f0e0/32.png) [@usultonov\_b18](https://forum.makecode.com/u/usultonov_b18)\
**Post date:** [July 5, 2022, 5:12pm UTC](https://forum.makecode.com/t/integrating-the-maxrefdes117-with-the-micro-bit-c/14328/1 "2022-07-05T17:12:39Z")

</div>

Hello,  
Has anyone used the **MAXREFDES117** from maxim integrated with the micro:bit before? It’s a pulse oximeter sensor from [rs online](https://uk.rs-online.com/web/p/sensor-development-tools/1914234?cjevent=204a634d228b4c3dd24130004903c32797c00cdf9f2cc20e7&cmmmc=UK-CJAFF--JVWEB+PERFORMANCE-) which has example source code available for both arduino and mbed platforms (micro:bit is an mbed platform).

The MAXREFDES117 has 3 **C++** files and 3 header files: algorithm.cpp, MAX30102.cpp, and main.cpp. I don’t have code specifically for the micro:bit, but only a select number of boards. The code from the manufacturer ([link to code](https://os.mbed.com/teams/Maxim-Integrated/code/RD117_MBED/)) is specifically designed for mbed platforms: • Maxim Integrated MAX32600MBED# • Freescale FRDM-K64F • Freescale FRDM-KL25Z. However, as micro:bit is an mbed platform as well (same version number), and the sensor should be able to be powered by the micro:bit’s 3V pin voltage, I tried using the micro:bit, but the code doesn’t work with it.

The errors that the mbed ([online](https://os.mbed.com/)) compiler shows include (I can’t see the next error until I fix the last) the following:

- As provided (unchanged code from above link), the compiler states: _“Error: Identifier “I2C\_SDA” is undefined in “MAX30102/MAX30102.cpp”, Line: 65, Col: 10”_. According to [link](https://maximsupport.microsoftcrmportals.com/en-us/knowledgebase/article/000100869), using a different board to what is suggested needs only a change in the **I2C** pin assignments. However, I am not sure where in the code I would update the pins. I have tried to avoid the error stated by the compiler by swapping out `'I2C i2c(I2C_SDA, I2C_SCL);'` with `'MicroBitI2C i2c = MicroBitI2C(I2C_SDA0, I2C_SCL0);'`, but I am not sure whether this is correct. If I do this swap, the compiler then considers the error solved and shows up with the next one:

- As provided and the swap from the last error implemented, the compiler states: _“Error: Identifier “INT” is undefined in “main.cpp”, Line: 139, Col: 16”_. The code uses the **INT** pin which isn’t a specific pin on the microbit, so I’m not sure what that would connect to. Upon searching for how I would use an interrupt pin on a micro:bit, I found that it is possible to set a pin as the interrupt pin using (from [link](https://tinygo.org/docs/reference/microcontrollers/machine/microbit/#func-pin-setinterrupt)): `func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error`  
However, I am not sure how I would implement this into the micro:bit, or how it works.

Apologies for my lack of understanding in C++, but please could you assist me in interacting the micro:bit with the MAXREFDES117. Thank you very much
