What it is: A flame sensor is an infrared photodiode tuned to the ~760–1100 nm light a flame gives off. It detects an open flame up to about a metre away and is the core of fire-alarm and firefighting-robot projects.
How it works: The module's analog output (AO) changes with how much flame-IR hits it — typically the voltage drops when a flame is detected. This sketch reads AO and flags "FIRE" when the reading crosses a threshold you can tune.
Wiring:
Flame AO -> GPIO0 (analog)
Flame VCC -> 3V3
Flame GND -> GND
OLED VCC=3V3, GND=GND, SDA=GPIO4, SCL=GPIO5
Libraries: only "Adafruit SSD1306" and "Adafruit GFX Library".
On screen / Serial: "SAFE" or "FIRE!" plus the raw ADC value so you can pick a good THRESHOLD. Test with a lighter or candle at a safe distance.
Gotchas: These sensors also react to strong sunlight and incandescent bulbs — shield the project from those. Adjust THRESHOLD in the code to your module and lighting. The onboard blue trimmer sets the digital-out point, not the analog reading.