This is a demo based on Seeeduino XIAO and basic Grove sensors like DHT11 temperature & humidity sensor and light sensor to display the value on the SSD1315 OLED. And here is a Grove touch module for controlling the whole system and the OLED to display the data. Seeeduino XIAO is completely compatible with Arduino, so this demo is based on Arduino IDE. For details, you can click here to install the board in the Arduino IDE.
Both of the Light sensor and OLED display can be driven by I2C interface, but they have different I2C addresses. So they are connected with the same of the Seeeduino XIAO’s I2C interface as slaves. There aren’t any pull-up resistances in Seeeduino XIAO’s Pins, as a matter of fact, the communication might be unstable between Seeeduino XIAO and two slave modules. For stability in the real use, I strongly recommended you to add pull-up resistances at the end of the I2C interfaces. DHT11 temperature sensor and Grove touch module simply connect with the Seeeduino XIAO by digital Pins. The overall hardware connection is really easy. Here is the Pinout of the Seeeduino XIAO.
As for the software code, you can find most of the modules getting started codes and libraries from the Seeed Wiki. It is worth to mention that the SSD1315 OLED Display uses the common U8g2 library which is a functional library to display multiple fonts and images. U8g2 library supports many types of OLED screens and a great many fonts libraries. The demo code is available as follows.
With the correct connection of jump wires and the code below, you can realize the demo of displaying the sensor values in the SSD1315 OLED display once you touch the touchpad, and the display will be cleared when you leave the touchpad. Due to the tiny size of Seeeduino XIAO, you are able to make it as a wearable environment detector to measure the values of temperature, humidity, and light everywhere you like.