Organise large Arduino codebase with libraries, files and folders // Arduino CLI, Nano 33 BLE Sense
Channel: Sayanee Basu
Date: 15/01/2021

#organize #codebase #arduino
I used to have long Arduino *.ino sketch files that were difficult to debug and add features. In this video, I share several incremental steps to take to split a big Arduino code file into separate different files and folders for future maintainability. Plus, we will use Arduino CLI to install libraries and track its version. We will use the Arduino Nano 33 BLE Sense board for a practical example in one file before splitting the code into manageable bits.

⏰ TIMESTAMPS
0:00 Intro
02:17 Create new codebase
06:52 Step 1: Install library
09:50 Step 2: Split code into *.ino files https://hutscape.com/tutorials/nano33-ble-sense-more-ino
11:31 Step 3: Create header files
13:07 Step 4: Create header and cpp files https://hutscape.com/tutorials/nano33-ble-sense-imu-sensors
15:08 Step 5: Create src folder https://hutscape.com/tutorials/more-files
17:30 Step 6: Enable multiple tasks in loop()
20:15 Outro

‣ Some links below are affiliate. I receive a small commission at no extra cost to you.

🎩 MORE DEMO FILES
Display IMU data with LSM9DS1 https://hutscape.com/tutorials/nano33-ble-sense-imu
Display temperature and humidity data with HTS221 https://hutscape.com/tutorials/nano33-ble-sense-temperature-humidity

📺 WATCH NEXT
6 ways to access the serial monitor for Arduino https://youtu.be/UwOLAL9z2Rk
Arduino CLI and the art of command line https://youtu.be/cVod8k713_8
Makefiles for using with Arduino https://youtu.be/Os5sGlw3PV0
Debugging Arduino firmware with print statements https://youtu.be/7kRlQDxGR9A

🔗 LINKS SHOWN
Arduino Nano 33 BLE Sense board https://store.arduino.cc/usa/nano-33-ble-sense
Getting started with the Arduino NANO 33 BLE Sense https://www.arduino.cc/en/Guide/NANO33BLESense/
Arduino LSM9DS1 IMU library https://github.com/arduino-libraries/Arduino_LSM9DS1
Simple accelerometer example code https://github.com/arduino-libraries/Arduino_LSM9DS1/blob/master/examples/SimpleAccelerometer/SimpleAccelerometer.ino
Arduino HTS221 sensor library https://github.com/arduino-libraries/Arduino_HTS221
Read sensor example code https://github.com/arduino-libraries/Arduino_HTS221/blob/master/examples/ReadSensors/ReadSensors.ino
Arduino CLI library specification https://arduino.github.io/arduino-cli/library-specification/
Arduino Sketch build process https://arduino.github.io/arduino-cli/latest/sketch-build-process/
Arduino Sketch specification https://arduino.github.io/arduino-cli/latest/sketch-specification/
Arduino millis() https://www.arduino.cc/reference/en/language/functions/time/millis/
Writing a library for Arduino https://www.arduino.cc/en/Hacking/libraryTutorial

🔌 TOOLS USED
https://hutscape.com/tools