Smart Agriculture Mission Banner - Image 1
Mission Mode 2

The Seeds of Innovation: Smart Agriculture

STORY

In a nearby town, Miguel helps his father maintain a small greenhouse. The weather often changes unexpectedly, harming their crops. With Captain T's help and TRIOE sensors, Miguel learns to monitor environmental conditions in real-time.

Smart Agriculture Challenge

Sensor Status

TEMP
HUM
PRES
Mission Icon

Mission Objectives

0/7

Build a weather station that shows temperature, humidity, and air pressure on a small screen!

Setup BME280 Sensor and Serial Monitor
Read Temperature, Humidity & Pressure
Display Data on OLED Screen (0x3C)
Update Display Every 2 Seconds
Include Required Libraries
Select TRIOE ESP32S3 Dev Module
Select COM7 Port
Code Editor Icon

Loading...
Arduino Reference Icon

Arduino Reference

BME280 & OLED Commands

bme.begin(0x3C)

Initialize BME280 sensor with I2C address

bme.readTemperature()

Read temperature in Celsius (returns float)

bme.readHumidity()

Read humidity percentage (returns float)

bme.readPressure()

Read pressure in Pascals (returns float)

display.clearDisplay()

Clear the display buffer

display.display()

Update the physical display with buffer content

display.setTextSize(1)

Set text size (1 = small, 2 = medium, etc.)

display.setTextColor(SSD1306_WHITE)

Set text color for OLED display

display.setCursor(x, y)

Set cursor position for text placement

display.print("text")

Print text at current cursor position

display.println("text")

Print text and move to next line

Basic Arduino Functions

void setup()

Runs once when Arduino starts - initialization code

void loop()

Runs repeatedly after setup() - main program logic

delay(milliseconds)

Pause execution for specified time in milliseconds

pinMode(pin, mode)

Configure pin as INPUT, OUTPUT, or INPUT_PULLUP

digitalWrite(pin, value)

Write HIGH or LOW to digital pin

digitalRead(pin)

Read digital value from pin (HIGH or LOW)

Serial Communication

Serial.begin(9600)

Initialize serial communication at 9600 baud rate

Serial.print("text")

Send text to serial monitor

Serial.println("text")

Send text with newline to serial monitor

Serial.available()

Check if data is available to read from serial

I2C Communication

#include <Wire.h>

Include Wire library for I2C communication

Wire.begin()

Initialize I2C communication as master

0x76, 0x3C

Common I2C addresses (BME280: 0x76, OLED: 0x3C)

Data Types & Variables

int variable = 0;

Integer variable (-32,768 to 32,767)

float variable = 0.0;

Floating point number (decimals)

bool variable = true;

Boolean variable (true or false)

String text = "hello";

String variable for text

Control Structures

if (condition)

Execute code if condition is true

while (condition)

Repeat code while condition is true

for (int i=0; i<10; i++)

Loop with counter variable

Common Constants

HIGH, LOW

Digital pin states (5V/0V)

INPUT, OUTPUT

Pin modes for pinMode()

true, false

Boolean values

Serial Monitor Icon

Serial Monitor

Arduino IDE Serial Monitor - TRIOE Board Connected to COM3 at 9600 baud BME280 Sensor Status: Waiting for initialization... OLED Display Status: Waiting for initialization... Press "Verify Code" to compile and check your sketch.
Smart Agriculture Mission