Communication between TWO Arduino nano 33 ble sense

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

1 Like

Can you please modify your post to ensure the source code is in a single box. It should look like this.

// Your example source code

You need three ' at the beginning and end in the edit window? When you click on this icon </> you get.

type or paste code here

This ensures we can get all the source code. Right now if you copy the code there are invisible characters that prevent successful compilation and parts might be missing.

My last message describes how to add another characteristic for a second sensor and some functions to handle the new sensor. It sounded like you wanted to add a radiation sensor as well.

As for integrating my part into your code. You need to integrate your code into mine. That is what the sensorTask and gasCoConvertToPPM are for. They are examples of what you need to do. The rest of the sketch will likely work without a lot of modifications.

I noted the following in your code {X==1;} This is likely wrong.

As a little tip, I recommend you avoid using any other languages except C/C++ and English in your code. e.g. valeurLue ? . It makes reading code harder then it already is. :slight_smile:

1 Like

Thank you for your comments, I deleted my old code and, I did not manage to work on it because I changed the sensor completely (delivery time unknown), good news for me I received the digital sensor (UART), it's the only one I have in my hands, For now I don't need to work on the old one (that's why I deleted it the code)

thanks for your understanding :slightly_smiling_face:

For now i don't know if i will use the last code and i will manage only the part of analog to digital , and I didn't know how to do it on my own, or If someone can help me with the programming part for this sensor, so that I can send the read value to the 2nd arduino ble sense 33 VIA ble.

Here is his datasheet
CityTech-iSeries-Intell-iCO-DTS-EN-LTR-0121-2_draft1 (2).pdf (1,2 Mo)

Thank you very much.

You need to the get the User Manual. See note in document:

... please refer to the user’s manual (for UART communication) ...

This will tell us what we need to do to start the sensor and receive data.

Please find attached the user manual part of the communication protocol,
waiting your help please.
City-Tech_SDCS-Comm-Protocol_iSeries_EXTERNAL-EN-LTR-0221-1-002713-1-EN.pdf (2,4 Mo)

Thank you.

That is the right document. That is some serious sensor protocol. If I where you I would contact the manufacturer support team AFTER you scout their website a bit more and ask for some application code or library. They clearly wrote some software for testing. They even have code for the CRC in the document.

If they do not have that available, you will need to write a library yourself. I do not believe this should be too hard, but it will take some experimenting and debugging. Unfortunately, the protocol requires quite a couple of bytes and there are timing requirements as well. So, this is not as easy as other simpler sensors.

I recommend you become good friends with that data sheet. Also, while you write the library, I would use a simple sketch without all the BLE stuff. Once that works, combining will be simpler.