### Full Setup (default settings) Source: https://docs.soldered.com/ltr-507/arduino/init-and-settings Example code demonstrating the full setup and initialization of the LTR-507 sensor with default settings. ```APIDOC ## Full Setup (default settings) ### Description This section outlines the default settings used when initializing the sensor. It can be helpful to refer to these if you wish to modify any of the settings during your project. ### Method ```c void setup() ``` ### Endpoint N/A (This is a setup function) ### Parameters None ### Request Example ```c // Include needed libraries #include "LTR-507-Light-And-Proximity-Sensor-SOLDERED.h" // Create light_sensor object LTR507 light_sensor; void setup() { // Begin Serial for debugging purposes Serial.begin(115200); // Initialize the light_sensor! light_sensor.init(); // Set the gain of the light_sensor light_sensor.setALSGain(LTR507_ALS_GAIN_RANGE1); // Set the automatic measurement rate light_sensor.setALSMeasRate(LTR507_ALS_MEASUREMENT_RATE_100MS); // Set the auto measurement rate for proximity light_sensor.setPSMeasRate(LTR507_PS_MEASUREMENT_RATE_100MS); // Set the max current supplied to the IR LED light_sensor.setLEDPeakCurrent(LTR507_LED_PEAK_CURRENT_50MA); // Set the pulse frequency of the IR LED light_sensor.setLEDPulseFreq(LTR507_LED_PULSE_FREQ_60KHZ); // Set the number of pulses for a proximity measurement (1-15) light_sensor.setPSNumPulses(1); } ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Full MQ Sensor Initialization Example Source: https://docs.soldered.com/mq/arduino/initialization-qwiic Complete example demonstrating library inclusion, setup, and calibration. ```cpp // Include the library #include // How many R0 readings to take to get an average measurement #define numOfCalibrations 10 // Create an instance of the sensor object MQ8 mq8; void setup() { // Initialize the serial port communication at 115200 baud. It's used to print measured data. Serial.begin(115200); // Initialize I2C connection with the sensor; if it fails, inform the user if(!mq8.begin(0x30)) { Serial.println("Failed to initialize I2C communication, check wiring"); while(1) {} } /***************************** MQ Calibration ********************************************/ // Explanation: // In this routine, the sensor will measure its resistance after it has been pre-heated for 48h // and is now in a clean air environment, and it will set up the R0 value. // This routine does not need to be executed on every restart; you can load your R0 into flash memory and read it on startup Serial.print("Calibrating please wait."); bool calibrationResult = mq8.calibrateSensor(numOfCalibrations); if(!calibrationResult) // Check if the sensor was properly calibrated { Serial.println("There was an error reading the sensor, check connection and try again"); while(1) {} } Serial.print("Calibration done!"); /***************************** MQ Calibration ********************************************/ } void loop() { } ``` -------------------------------- ### Full APDS-9960 initialization and reading example Source: https://docs.soldered.com/apds-9960/arduino/color-sensor Complete example including library inclusion, object creation, setup, and the main loop for color detection. ```cpp // Include the library #include "APDS9960-SOLDERED.h" // Create an APDS-9960 object APDS_9960 APDS; // Setup function, runs once void setup() { Serial.begin(115200); // Begin serial communication with the PC while (!Serial) // Wait until serial becomes active ; if (!APDS.begin()) // Begin communication with the sensor { Serial.println("Error initializing APDS-9960 sensor!"); while (1); // Loop forever if the sensor is not available } Serial.println("Sensor initialized."); } void loop() { // check if a color reading is available while (!APDS.colorAvailable()) { delay(5); // Wait for a color reading to be available } int r, g, b; // Initialize variables for color intensities // read the color APDS.readColor(r, g, b); // print the values Serial.print("r = "); Serial.println(r); Serial.print("g = "); Serial.println(g); Serial.print("b = "); Serial.println(b); Serial.println(); // wait a bit before reading again delay(1000); } ``` -------------------------------- ### Full sensor measurement example Source: https://docs.soldered.com/electrochemical-gas-sensor/arduino/single-sensor-measurement-example A complete example combining initialization, setup, and the measurement loop. ```cpp // Include the required library #include "Electrochemical-Gas-Sensor-SOLDERED.h" // Create the sensor object with the according type ElectrochemicalGasSensor sensor(SENSOR_NH3); void setup() { Serial.begin(115200); // For debugging // Initialize the breakout if (!sensor.begin()) { // Can't initialize? Notify the user and enter an infinite loop Serial.println("ERROR: Can't init the sensor! Check connections!"); while (true) delay(100); } Serial.println("Sensor initialized successfully!"); } void loop() { // Make the reading double reading = sensor.getPPM(); // Print the reading with 5 digits of precision Serial.print("Sensor reading: "); Serial.print(reading, 5); Serial.println(" PPM"); // Wait a bit before reading again delay(2500); } ``` -------------------------------- ### Initialize LTR-507 Sensor with Default Settings Source: https://docs.soldered.com/ltr-507/arduino/init-and-settings Full setup example demonstrating library inclusion, object creation, and initialization with default sensor parameters. ```cpp // Include needed libraries #include "LTR-507-Light-And-Proximity-Sensor-SOLDERED.h" // Create light_sensor object LTR507 light_sensor; void setup() { // Begin Serial for debugging purposes Serial.begin(115200); // Initialize the light_sensor! light_sensor.init(); // Set the gain of the light_sensor light_sensor.setALSGain(LTR507_ALS_GAIN_RANGE1); // Set the automatic measurement rate light_sensor.setALSMeasRate(LTR507_ALS_MEASUREMENT_RATE_100MS); // Set the auto measurement rate for proximity light_sensor.setPSMeasRate(LTR507_PS_MEASUREMENT_RATE_100MS); // Set the max current supplied to the IR LED light_sensor.setLEDPeakCurrent(LTR507_LED_PEAK_CURRENT_50MA); // Set the pulse frequency of the IR LED light_sensor.setLEDPulseFreq(LTR507_LED_PULSE_FREQ_60KHZ); // Set the number of pulses for a proximity measurement (1-15) light_sensor.setPSNumPulses(1); } ``` -------------------------------- ### Full Example Source: https://docs.soldered.com/inkplate/10/wifi/wifi-basics Link to a more comprehensive example demonstrating WiFi usage. ```APIDOC ## Full Example ### Description To see more details, check out our full examples: ### Inkplate_10_WiFi_examples Inkpate 10 WiFi examples from Inkplate library ``` -------------------------------- ### Full Alarm Example Source: https://docs.soldered.com/pcf85063a/arduino/setting-up-an-alarm Complete implementation including library inclusion, setup, loop, and helper functions. ```cpp #include "PCF85063A-SOLDERED.h" // Create an instance of the RTC object PCF85063A rtc; // Pin on the Dasduino that is connected to the INT pin on the RTC const uint8_t InterruptPin = 4; // Function that will be called when an interrupt occurs void IRAM_ATTR alarm() { Serial.println("ALARM TRIGGERED"); } void setup() { Serial.begin(115200); rtc.begin(); pinMode(InterruptPin, INPUT_PULLUP); attachInterrupt(InterruptPin, alarm, FALLING);; // setTime(hour, minute, sec); rtc.setTime(12, 57, 00); // 24H mode, ex. 12:57:00 // setDate(weekday, day, month, yr); rtc.setDate(1, 31, 3, 2025); // 0 for Sunday, ex. Saturday, 16.5.2020. // setAlarm(alarm_second, alarm_minute, alarm_hour, alarm_day, alarm_weekday); rtc.setAlarm(00, 59, 99, 99, 99); // use 99 if no alarm } void loop() { // Function that works as in the previous example we covered printCurrentTime(); delay(1000); } void printCurrentTime() { switch (rtc.getWeekday()) // Get weekday, 0 is Sunday and decode to string { case 0: Serial.print("Sunday, "); break; case 1: Serial.print("Monday, "); break; case 2: Serial.print("Tuesday, "); break; case 3: Serial.print("Wednesday, "); break; case 4: Serial.print("Thursday, "); break; case 5: Serial.print("Friday, "); break; case 6: Serial.print("Saturday, "); break; } Serial.print(rtc.getDay()); // Function for getting day in month Serial.print("."); Serial.print(rtc.getMonth()); // Function for getting month Serial.print("."); Serial.print(rtc.getYear()); // Function for getting year Serial.print(". "); Serial.print(rtc.getHour()); // Function for getting hours Serial.print(":"); Serial.print(rtc.getMinute()); // Function for getting minutes Serial.print(":"); Serial.println(rtc.getSecond()); // Function for getting seconds } ``` -------------------------------- ### Full Example Source: https://docs.soldered.com/inkplate/6flick/wifi/wifi-basics Link to a full example demonstrating WiFi usage with the Inkplate 6FLICK. ```APIDOC ## Full example To see more details, check out our full examples: ### Inkplate_6FLICK_WiFi_examples Inkpate 6FLICK WiFi examples from Inkplate library ``` -------------------------------- ### Full MCP47A1 example Source: https://docs.soldered.com/mcp47a1/arduino/examples A complete example combining initialization and voltage control. ```cpp #include "MCP47A1-SOLDERED.h" // Include Soldered library for MCP47A1 DAC. MCP47A1_SOLDERED dac; // Create an instance of the object void setup() { dac.begin(); // Initialize the DAC library. } void loop() { float volts; // Set DAC output voltage to 0 V volts = 0; dac.setVoltage(volts); delay(2000); // Set DAC output voltage to 1 V volts = 1; dac.setVoltage(volts); delay(2000); // Set DAC output voltage to 2.5 V volts = 2.5; dac.setVoltage(volts); delay(2000); // Set DAC output voltage to 3.3 V volts = 3.3; dac.setVoltage(volts); delay(2000); } ``` -------------------------------- ### Initialize Led Matrix and Display Animation Source: https://docs.soldered.com/led-matrix/arduino/displaying-animation Include the Led-Matrix library, create a matrix object, and initialize it in the setup() function. The begin() method checks for correct connection. This example animates a Pacman character. ```cpp #include "Led-Matrix-SOLDERED.h" #include #define HARDWARE_TYPE Led_Matrix::PAROLA_HW #define MAX_DEVICES 3 #define CLK_PIN 18 // or SCK #define DATA_PIN 23 // or MOSI #define CS_PIN 4 // or LOAD Led_Matrix mx = Led_Matrix(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); // SPI hardware interface // -------------------- // Constant parameters // #define ANIMATION_DELAY 75 // Milliseconds #define MAX_FRAMES 4 // Number of animation frames // ========== General Variables =========== // const uint8_t pacman[MAX_FRAMES][18] = // Pacman pursued by a ghost { {0xfe, 0x73, 0xfb, 0x7f, 0xf3, 0x7b, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x7e, 0xff, 0xe7, 0xc3, 0x81, 0x00}, {0xfe, 0x7b, 0xf3, 0x7f, 0xfb, 0x73, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xe7, 0xe7, 0x42, 0x00}, {0xfe, 0x73, 0xfb, 0x7f, 0xf3, 0x7b, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xe7, 0x66, 0x24}, {0xfe, 0x7b, 0xf3, 0x7f, 0xf3, 0x7b, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, 0x7e, 0x3c}, }; const uint8_t DATA_WIDTH = (sizeof(pacman[0]) / sizeof(pacman[0][0])); uint32_t prevTimeAnim = 0; // Remember the millis() value in animations int16_t idx; uint8_t frame; uint8_t deltaFrame; // ========== Control routines =========== // void resetMatrix(void) { mx.control(Led_Matrix::INTENSITY, MAX_INTENSITY / 2); mx.control(Led_Matrix::UPDATE, Led_Matrix::ON); mx.clear(); } void setup() { mx.begin(); // Init matrix resetMatrix(); prevTimeAnim = millis(); // Remember the last animation time // Init serial communication if it's needed } void loop(void) { static boolean bInit = true; // Initialise the animation // Is it time to animate? if (millis() - prevTimeAnim < ANIMATION_DELAY) return; prevTimeAnim = millis(); // Starting point for next time mx.control(Led_Matrix::UPDATE, Led_Matrix::OFF); // Initialize if (bInit) { mx.clear(); idx = -DATA_WIDTH; frame = 0; deltaFrame = 1; bInit = false; // Lay out the dots for (uint8_t i = 0; i < MAX_DEVICES; i++) { mx.setPoint(3, (i * COL_SIZE) + 3, true); mx.setPoint(4, (i * COL_SIZE) + 3, true); mx.setPoint(3, (i * COL_SIZE) + 4, true); mx.setPoint(4, (i * COL_SIZE) + 4, true); } } // Clear old graphic for (uint8_t i = 0; i < DATA_WIDTH; i++) mx.setColumn(idx - DATA_WIDTH + i, 0); // Move reference column and draw new graphic idx++; for (uint8_t i = 0; i < DATA_WIDTH; i++) mx.setColumn(idx - DATA_WIDTH + i, pacman[frame][i]); // Advance the animation frame frame += deltaFrame; if (frame == 0 || frame == MAX_FRAMES - 1) deltaFrame = -deltaFrame; // Check if we are completed and set initialise for next time around bInit = (idx == mx.getColumnCount() + DATA_WIDTH); mx.control(Led_Matrix::UPDATE, Led_Matrix::ON); return; } ``` -------------------------------- ### Perform GET Request and Display HTML on Inkplate 6 Source: https://docs.soldered.com/inkplate/6/wifi/get-post This example demonstrates how to connect to WiFi, perform an HTTP GET request to fetch an HTML file, and display its content on the Inkplate 6 screen. Ensure you have the Inkplate, HTTPClient, and WiFi libraries installed. ```cpp #include "Inkplate.h" //Include Inkplate library to the sketch #include //Include HTTP library to this sketch #include //Include ESP32 WiFi library to our sketch #define ssid "yourssid" // Name of the WiFi network (SSID) that you want to connect Inkplate to #define pass "yourpassword" // Password of that WiFi network Inkplate inkplate(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (BW) void setup() { inkplate.begin(); // Init Inkplate library (you should call this function ONLY ONCE) inkplate.clearDisplay(); // Clear frame buffer of display inkplate.display(); // Put clear image on Inkplate inkplate.setTextSize(2); // Set text scaling to two (text will be two times bigger) inkplate.setCursor(0, 0); // Set print position inkplate.setTextColor(BLACK, WHITE); // Set text color to black and background color to white inkplate.println("Scanning for WiFi networks..."); // Write text inkplate.display(); // Send everything to Inkplate (refresh Inkplate) int n = WiFi.scanNetworks(); // Start searching WiFi networks and put the number of found WiFi networks in variable // n if (n == 0) { // If you did not find any networks, show the message and stop the program. inkplate.print("No WiFi networks found!"); inkplate.partialUpdate(); while (true) ; } else { if (n > 10) n = 10; // If you did find any, print name (SSID), encryption and signal strength of first 10 networks for (int i = 0; i < n; i++) { inkplate.print(WiFi.SSID(i)); inkplate.print((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? 'O' : '*'); inkplate.print('\n'); inkplate.print(WiFi.RSSI(i), DEC); } inkplate.partialUpdate(); //(Partial) refresh the screen } inkplate.clearDisplay(); // Clear everything in frame buffer inkplate.setCursor(0, 0); // Set print cursor to new position inkplate.print("Connecting to "); // Print the name of the WiFi network inkplate.print(ssid); WiFi.begin(ssid, pass); // Try to connect to the WiFi network while (WiFi.status() != WL_CONNECTED) { delay(1000); // While it is connecting to the network, Inkplate prints a dot every second to show that it is alive. inkplate.print('.'); inkplate.partialUpdate(); } inkplate.print("connected"); // If it's connected, notify user inkplate.partialUpdate(); HTTPClient http; if (http.begin("http://example.com/index.html")) { // Now try to connect to some web page (in this example www.example.com. And yes, this is a valid web page :)) if (http.GET() > 0) { // If the connection was successful, try to read content of the web page and print it on screen String htmlText; htmlText = http.getString(); inkplate.setTextSize(1); // Set smaller text size, so everything can fit on screen inkplate.clearDisplay(); inkplate.setCursor(0, 0); inkplate.print(htmlText); inkplate.display(); } } else{ } } void loop() { // Nothing } ``` -------------------------------- ### GET Request Example Source: https://docs.soldered.com/inkplate/6flick/wifi/get-post Example code demonstrating how to perform a GET request to fetch an HTML file and display it on the Inkplate. ```APIDOC ## GET /example.com/index.html ### Description Fetches an HTML file from a specified URL and displays its content on the Inkplate. ### Method GET ### Endpoint `http://example.com/index.html` ### Parameters None ### Request Body None ### Request Example ```cpp #include "Inkplate.h" #include #include #define ssid "yourssid" #define pass "yourpassword" Inkplate inkplate(INKPLATE_1BIT); void setup() { inkplate.begin(); inkplate.clearDisplay(); inkplate.display(); inkplate.setTextSize(2); inkplate.setCursor(0, 0); inkplate.setTextColor(BLACK, WHITE); inkplate.println("Scanning for WiFi networks..."); inkplate.display(); int n = WiFi.scanNetworks(); if (n == 0) { inkplate.print("No WiFi networks found!"); inkplate.partialUpdate(); while (true); } else { if (n > 10) n = 10; for (int i = 0; i < n; i++) { inkplate.print(WiFi.SSID(i)); inkplate.print((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? 'O' : '*'); inkplate.print('\n'); inkplate.print(WiFi.RSSI(i), DEC); } inkplate.partialUpdate(); } inkplate.clearDisplay(); inkplate.setCursor(0, 0); inkplate.print("Connecting to "); inkplate.print(ssid); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(1000); inkplate.print('.'); inkplate.partialUpdate(); } inkplate.print("connected"); inkplate.partialUpdate(); HTTPClient http; if (http.begin("http://example.com/index.html")) { if (http.GET() > 0) { String htmlText; htmlText = http.getString(); inkplate.setTextSize(1); inkplate.clearDisplay(); inkplate.setCursor(0, 0); inkplate.print(htmlText); inkplate.display(); } } else { } } void loop() { // Nothing } ``` ### Response #### Success Response (200) - **htmlText** (String) - The content of the HTML file. #### Response Example ``` Example Domain

Example Domain

This domain is for use in illustrative examples in documents. You may use this content freely in demonstrations and examples.

More information...

``` ``` -------------------------------- ### GET Request Example Source: https://docs.soldered.com/inkplate/4tempera/wifi/get-post Example code demonstrating how to perform an HTTP GET request to fetch data from a URL and display it on the Inkplate screen. ```APIDOC ## GET /example.com/index.html ### Description Fetches the content of a specified HTML file from a web server. ### Method GET ### Endpoint http://example.com/index.html ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```cpp HTTPClient http; if (http.begin("http://example.com/index.html")) { if (http.GET() > 0) { String htmlText = http.getString(); // Process htmlText } } ``` ### Response #### Success Response (200) - **htmlText** (String) - The content of the requested HTML file. #### Response Example ```

Hello, Inkplate!

``` ``` -------------------------------- ### Example Usage: Writing "Hello World!" Source: https://docs.soldered.com/ssd1306/arduino/writing-text Demonstrates how to use `setTextSize`, `setTextColor`, `setCursor`, `print`, and `display` to write "Hello World!" to the SSD1306 display. ```APIDOC ## Example Usage: Writing "Hello World!" ### Description This example shows how to clear the display, set text properties, position the cursor, print a message, and finally update the display. ### Code Example ```cpp void loop() { delay(1000); // Clear the last image shown on screen display.clearDisplay(); // Normal 1:1 pixel scale display.setTextSize(1); // Draw white text display.setTextColor(SSD1306_WHITE); // Start at top-left corner display.setCursor(0, 0); // Message we want to display String message = "Hello World!"; // Inform the display of the text you want to print display.print(message); // Display the message display.display(); } ``` ``` -------------------------------- ### GET Request Example Source: https://docs.soldered.com/inkplate/6/wifi/get-post This example demonstrates how to connect to a WiFi network, perform an HTTP GET request to fetch HTML content from a URL, and display it on the Inkplate 6 screen. ```APIDOC ## GET /example.com/index.html ### Description Fetches the content of a specified HTML file from a web server. ### Method GET ### Endpoint `http://example.com/index.html` ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```cpp #include "Inkplate.h" #include #include #define ssid "yourssid" #define pass "yourpassword" Inkplate inkplate(INKPLATE_1BIT); void setup() { inkplate.begin(); inkplate.clearDisplay(); inkplate.display(); inkplate.setTextSize(2); inkplate.setCursor(0, 0); inkplate.setTextColor(BLACK, WHITE); inkplate.println("Scanning for WiFi networks..."); inkplate.display(); int n = WiFi.scanNetworks(); if (n == 0) { inkplate.print("No WiFi networks found!"); inkplate.partialUpdate(); while (true); } else { if (n > 10) n = 10; for (int i = 0; i < n; i++) { inkplate.print(WiFi.SSID(i)); inkplate.print((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? 'O' : '*'); inkplate.print('\n'); inkplate.print(WiFi.RSSI(i), DEC); } inkplate.partialUpdate(); } inkplate.clearDisplay(); inkplate.setCursor(0, 0); inkplate.print("Connecting to "); inkplate.print(ssid); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(1000); inkplate.print('.'); inkplate.partialUpdate(); } inkplate.print("connected"); inkplate.partialUpdate(); HTTPClient http; if (http.begin("http://example.com/index.html")) { if (http.GET() > 0) { String htmlText; htmlText = http.getString(); inkplate.setTextSize(1); inkplate.clearDisplay(); inkplate.setCursor(0, 0); inkplate.print(htmlText); inkplate.display(); } } else { // Handle connection error } } void loop() { // Nothing } ``` ### Response #### Success Response (200) - **htmlText** (String) - The HTML content of the requested page. #### Response Example ```html Example Domain

Example Domain

This domain is for use in illustrative examples in documents. You may use this content freely in Vour own documentation projects.

More information...

``` ``` -------------------------------- ### Inkplate 10 GET Request Example Source: https://docs.soldered.com/inkplate/10/wifi/get-post This example demonstrates how to connect to a WiFi network, make a GET request to a specified URL, and display the received HTML content on the Inkplate 10. ```APIDOC ## GET /example.com/index.html ### Description This endpoint demonstrates fetching HTML content from a given URL using an HTTP GET request and displaying it on the Inkplate. ### Method GET ### Endpoint `http://example.com/index.html` ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```cpp #include "Inkplate.h" #include #include #define ssid "yourssid" #define pass "yourpassword" Inkplate inkplate(INKPLATE_1BIT); void setup() { inkplate.begin(); inkplate.clearDisplay(); inkplate.display(); inkplate.setTextSize(2); inkplate.setCursor(0, 0); inkplate.setTextColor(BLACK, WHITE); inkplate.println("Connecting to "); inkplate.print(ssid); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(1000); inkplate.print('.'); inkplate.partialUpdate(); } inkplate.print("connected"); inkplate.partialUpdate(); HTTPClient http; if (http.begin("http://example.com/index.html")) { if (http.GET() > 0) { String htmlText; htmlText = http.getString(); inkplate.setTextSize(1); inkplate.clearDisplay(); inkplate.setCursor(0, 0); inkplate.print(htmlText); inkplate.display(); } } } void loop() { // Nothing } ``` ### Response #### Success Response (200) - **htmlText** (String) - The HTML content retrieved from the URL. #### Response Example ```html Example Page

This is a heading

This is a paragraph.

``` ``` -------------------------------- ### Read File Line by Line in setup() Source: https://docs.soldered.com/microsd-reader/arduino/reading-files Initializes serial communication, the SD card, and its volume. Then, opens 'hello.txt' in read mode and reads its content line by line using fgets. ```cpp void setup() { //Initialize the serial communication Serial.begin(115200); // Wait for USB Serial while (!Serial) { yield(); } Serial.println("Type any character to start"); while (!Serial.available()) { yield(); } // Initialize the SD. if (!sd.cardBegin(SD_CONFIG)) { sd.initErrorHalt(&Serial); return; } if(!sd.volumeBegin()) { Serial.println("Failed to initialize volume!"); return; } // Create the file. if (!file.open("hello.txt", FILE_READ)) { Serial.println("Failed to open file!"); return; } // Read data from file line by line while(file.available()) { int n = file.fgets(line, sizeof(line)); //Check if there was an error getting the line from text if (n <= 0) { Serial.println("fgets failed"); } //Check if the line was longer than the buffer if (line[n - 1] != '\n' && n == (sizeof(line) - 1)) { Serial.println("line too long"); } Serial.println(line); } // Close the file we were reading from. file.close(); Serial.println("Reading from file done!"); } ``` -------------------------------- ### Full Example Source: https://docs.soldered.com/accelerometer-gyroscope/arduino/examples-accelerometer A complete example demonstrating how to initialize the LSM6DS3 sensor and continuously read acceleration data. ```APIDOC ## Full example ### Description Try all of the aforementioned functions in this full example, which prints out the measured acceleration over Serial at 115200 baud: ### Code Example ```cpp // Include libraries #include "LSM6DS3-SOLDERED.h" #include "Wire.h" // Create object from LSM library Soldered_LSM6DS3 myIMU; // Default address is 0x6B void setup() { // Init serial communication Serial.begin(115200); delay(1000); // Relax... // Call .begin() to configure the IMU myIMU.begin(); } void loop() { // Get all parameters and print them on the Serial Monitor // Read acceleration and print it on serial Serial.print("ACCX:"); Serial.print(myIMU.readFloatAccelX(), 4); Serial.print(","); Serial.print("ACCY:"); Serial.print(myIMU.readFloatAccelY(), 4); Serial.print(","); Serial.print("ACCZ:"); Serial.print(myIMU.readFloatAccelZ(), 4); Serial.print(","); delay(150); } ``` ### minimalistExample.ino Most basic example of use. Example using the LSM6DS3 with basic settings ``` -------------------------------- ### Manual Installation Dependencies Source: https://docs.soldered.com/micropython/install When manually installing modules, you must also install any dependencies listed in the module's package.json file. This example shows the format for specifying dependencies. ```json "deps": [ ["github:SolderedElectronics/Soldered-Micropython-modules/Qwiic/Qwiic.py", "main"] ], ``` -------------------------------- ### WiFi.begin() Source: https://docs.soldered.com/inkplate/2/wifi/get-post Establishes a connection to a WiFi network. ```APIDOC ## WiFi.begin() ### Description This function attempts to connect to WiFi. ### Method N/A (Function) ### Endpoint N/A (Function) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Function Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Function Parameters | Type | Name | Description | |-------------|----------|----------------------------------------------| | `const char*` | `ssid` | Network SSID. | | `const char*` | `passphrase` | Optional, depends on WiFi network security certificate | ### Returns - **Type:** `wl_status_t` - **Value:** Returns `wl_status_t` enum value ``` -------------------------------- ### Install BME280 Module using mpremote Source: https://docs.soldered.com/micropython/install Example of installing the BME280 sensor module using mpremote. Ensure you have the correct category and module name. ```bash mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Sensors/BME280 ``` -------------------------------- ### Initialization Source: https://docs.soldered.com/lcd-i2c/arduino/examples Include the required library, create the LCD object, and initialize the LCD and backlight in the setup() function. ```APIDOC ## Initialization To use the LCD display include the **required library**, create the **LCD object** and **initialize** the LCD in the `setup()` function with `begin()`. **Backlight** is also initialized here. ℹ️ Our library uses the **Wire.h** library! ```cpp // Include the library #include "16x2-LCD-SOLDERED.h" LCD lcd; // Create the LCD object void setup() { lcd.begin(); // Initialize LCD lcd.backlight(); // Turn the backlight on } // ... ``` ### lcd.begin() Calls the Wire.begin() function which initializes the Wire library and joins the I2C bus as a controller or a peripheral. **Returns value:** None ``` -------------------------------- ### myIMU.begin() Source: https://docs.soldered.com/accelerometer-gyroscope/arduino/examples-temperature Initializes the LSM6DS3 sensor and verifies the connection. ```APIDOC ## myIMU.begin() ### Description Initializes the LSM6DS3 Accelerometer & Gyroscope sensor, setting up communication over I2C or SPI and configuring the sensor for operation. This function also verifies the presence of the sensor on the specified I2C address or SPI bus. ### Response - **Returns (boolean)** - Returns true if initialization is successful, false if it fails. ``` -------------------------------- ### Inkplate4TEMPERA_HTTP_GET_Request.ino Source: https://docs.soldered.com/inkplate/4tempera/wifi/get-post Example demonstrating an HTTP GET request with Inkplate 4TEMPERA. ```APIDOC ## Inkplate4TEMPERA_HTTP_GET_Request.ino ### Description Inkplate 4TEMPERA WiFi GET request example from the Inkplate library. ### Method GET ### Endpoint Refer to the example code for specific endpoint details. ### Parameters Refer to the example code for specific parameter details. ### Request Example Refer to the example code. ### Response Refer to the example code. ``` -------------------------------- ### Full Example Source: https://docs.soldered.com/lsm9ds1tr/arduino/examples-temperature This comprehensive example integrates sensor initialization and temperature reading, printing the measured temperature data in Celsius and Fahrenheit to the Serial Monitor at 115200 baud. ```APIDOC ## Full Example ### Description This full example demonstrates how to initialize the LSM9DS1TR sensor and continuously read and print temperature data in Celsius and Fahrenheit to the Serial Monitor. ### Code Example ```cpp // Include libraries #include "LSM9DS1TR-SOLDERED.h" #include "Wire.h" // Create object from LSM library LSM9DS1TR imu; // Default address for accelerometer/gyroscope is 0x6B void setup() { // Init serial communication Serial.begin(115200); delay(1000); // Relax... // Call .begin() to configure the IMU if (!imu.begin()) { Serial.println("Failed to initialize LSM9DS1!"); while (true) ; } } void loop() { // Get all parameters and print them to the Serial Monitor // Read the temperature and print it on serial Serial.print("DEGC:"); Serial.print(imu.readTempC(), 4); Serial.print(","); Serial.print("DEGF:"); Serial.println(imu.readTempF(), 4); delay(150); // Adjust delay for desired refresh rate } ``` ``` -------------------------------- ### Analog Hall Effect Sensor Example Source: https://docs.soldered.com/hall-effect-sensor/arduino/regular-analog-example This example demonstrates how to initialize and read data from the SI7211-B-00-IV Hall effect sensor using its analog output. It includes functions to get raw readings and convert them to milli Teslas. ```APIDOC ## Analog Hall Effect Sensor Example ### Description This code snippet shows how to use the SI7211-B-00-IV Hall effect sensor with an analog output to measure the strength of a magnetic field. It initializes the sensor, reads raw values, and converts these values into milli Teslas. ### Method Not applicable (Arduino sketch) ### Endpoint Not applicable (Arduino sketch) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp #include "Hall-Effect-SOLDERED.h" #define HALL_EFFECT_PIN 12 HallEffect_Analog hall(HALL_EFFECT_PIN); void setup() { Serial.begin(115200); } void loop() { uint16_t hallReading = hall.getReading(); float hallMilliTeslas = hall.getMilliTeslas(); Serial.print("Analog Hall Effect raw sensor reading: "); Serial.println(hallReading); Serial.print("Analog Hall Effect sensor reading in milli Teslas: "); Serial.print(hallMilliTeslas); Serial.println(" mT\n"); delay(1000); } ``` ### Response #### Success Response (200) Not applicable (Arduino sketch outputs to Serial Monitor) #### Response Example ``` Analog Hall Effect raw sensor reading: 512 Analog Hall Effect sensor reading in milli Teslas: 0.00 mT Analog Hall Effect raw sensor reading: 700 Analog Hall Effect sensor reading in milli Teslas: 25.50 mT ``` ### HallEffect_Analog hall() #### Description Creates an analog sensor object for the Hall effect sensor. #### Parameters - **pin** (uint16_t) - Required - Analog pin number for data communication. ### hall.getReading() #### Description Requests a new reading from the SI7211-B-00-IV sensor. #### Returns value - **reading** (uint16_t) - The raw integer value from the sensor's output pin. ### hall.getMilliTeslas() #### Description Calculates the magnetic induction value from the current sensor reading. #### Returns value - **milliTeslas** (float) - The magnetic induction value in milli Teslas (mT). ``` -------------------------------- ### Frontlight Example Code Source: https://docs.soldered.com/inkplate/4tempera/frontlight/simple-frontlight This example demonstrates how to turn on the frontlight at 50% brightness and keep it running. ```APIDOC ## Frontlight Example Code ### Description This example demonstrates how to turn on the frontlight at 50% brightness and keep it running. ### Method ```cpp void setup() { display.begin(); // Initialize the display display.setFrontlight(50); // Set frontlight brightness to 50% display.clearDisplay(); // Clear frame buffer display.setCursor(0, 20); // Set cursor position display.setTextSize(2); // Set text size display.setTextColor(BLACK); // Set text color display.print("Frontlight at 50%"); display.display(); // Refresh display } ``` ### Endpoint N/A (This is a library function example) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Full Example - APDS-9960 Color Sensor Source: https://docs.soldered.com/apds-9960/arduino/color-sensor This is a full Arduino sketch example for initializing and using the APDS-9960 color sensor. It includes setup for serial communication and sensor initialization, followed by the main loop for color detection. ```APIDOC ## Full Example - APDS-9960 Color Sensor ### Description This is a full Arduino sketch example for initializing and using the APDS-9960 color sensor. It includes setup for serial communication and sensor initialization, followed by the main loop for color detection. Open the Serial Monitor at 115200 baud to observe the detected color values. ### Method Not applicable (Arduino sketch) ### Endpoint Not applicable ### Parameters None ### Request Example None ### Response None ### Code Example ```cpp // Include the library #include "APDS9960-SOLDERED.h" // Create an APDS-9960 object APDS_9960 APDS; // Setup function, runs once void setup() { Serial.begin(115200); // Begin serial communication with the PC while (!Serial) // Wait until serial becomes active ; if (!APDS.begin()) // Begin communication with the sensor { Serial.println("Error initializing APDS-9960 sensor!"); while (1); // Loop forever if the sensor is not available } Serial.println("Sensor initialized."); } void loop() { // check if a color reading is available while (!APDS.colorAvailable()) { delay(5); // Wait for a color reading to be available } int r, g, b; // Initialize variables for color intensities // read the color APDS.readColor(r, g, b); // print the values Serial.print("r = "); Serial.println(r); Serial.print("g = "); Serial.println(g); Serial.print("b = "); Serial.println(b); Serial.println(); // wait a bit before reading again delay(1000); } ``` ``` -------------------------------- ### BMP388 Initialization and Setup Source: https://docs.soldered.com/bmp388/micropython/continuous-measurement This snippet shows how to initialize the BMP388 sensor, set its calibration parameters, and start continuous measurements. ```APIDOC ## BMP388 Initialization and Configuration ### Description Initializes the BMP388 sensor, sets sea level pressure for altitude calculations, configures the standby time between measurements, and starts continuous data conversion in normal mode. ### Methods #### `bmp388.BMP388()` Initializes the BMP388 sensor, setting up communication over I2C. **Returns value:** 1 if initialization was successful, 0 if not. #### `bmp388.setSeaLevelPressure(float pressure)` Sets the sea level value of pressure, used in calculating altitude. **Returns value:** None **Parameters:** - **pressure** (float) - Required - Pressure value in hPa #### `bmp388.setTimeStandby(enum TimeStandby standby)` Set the standby time of each sample. **Returns value:** None **Parameters:** - **standby** (enum TimeStandby) - Required - Time the sensor will be asleep between each measurement #### `bmp388.startNormalConversion()` Start BMP388 continuous conversion in normal mode. **Returns value:** None ### Request Example (Python) ```python from machine import Pin, I2C from bmp388 import BMP388 from bmp388_constants import TIME_STANDBY_1280MS import time # Initialize sensor over Qwiic bmp388 = BMP388() # Set sea level pressure for accurate altitude readings bmp388.setSeaLevelPressure(1025.0) # Set standby time to roughly 1.3 seconds bmp388.setTimeStandby(TIME_STANDBY_1280MS) # Start continuous measurement in normal mode bmp388.startNormalConversion() ``` ```