Need help programming C/C++ code to nano 33 ble sense

Hi everyone,

I would like to program my nano 33 ble sense in C/C++. I have an arduino uno board and I'm able to compile code and push code to the AtMega328P using Atmel Studio. I would like to do the same with the nano ble sense but i know that is built on the Nordic nRF52840 so I won't be able to utilize the same setup steps I did for my Uno.

If any one can either point me to something that can help me figure out how to program the nano ble sense with C/C++ code. I've searched for help with this but I had no luck. Admittedly, my search queries could be the reason why I haven't found anything of use as of now. But any help with this would be greatly appreciated.

Well, first of all you should be aware that the Arduino programming language we use in the .ino files of our sketches is a superset of C++. Any valid C++ is also a valid Arduino sketch. So you're welcome to just use the Arduino IDE as usual to program your Nano 33 BLE Sense using C++.

Before compilation, the .ino file undergoes some preprocessing to make it valid C++ code, after which it is compiled using a standard GCC C++ compiler. If you don't like that preprocessing, you'll be happy to learn that the Arduino IDE only does this to the .ino files of the sketch. Every Arduino sketch is required to contain a .ino file, but that file can be empty. You can add additional .cpp files to the sketch, which will be compiled as C++, or .c files, which will be compiled as C. No sketch preprocessing is done on these files. They are just passed directly to GCC. To add these files via the Arduino IDE, click the downward pointing triangle button on the right side of the tabs bar and then click "New Tab".

Pert: At what point does the IDE or compiler complain about a missing setup() and loop() function? Or are you expecting them to be in the .cpp file(s)?

setup() and loop() are called from the core library's main():

This is the reason these functions are normally required.

But you can override the core library's main() with one defined in your sketch. So if you add a custom main() that doesn't call setup() and loop(), then there is no requirement to define these functions in the sketch.

So a sketch can be as minimal as this:

int main() {
  return 0;

Of course, you should be aware that the core library's main() is doing some important things, so this is not something I would ever recommend to the sort of beginner or novice user Arduino is targeted toward. But it is nice that this sort of thing is possible for those who for some reason prefer to do without some of the "Arduino magic".

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.