من کد رو به صورت زیر عوض میکنم
کد:
//You may copy, alter and reuse this code in any way you like but please leave reference to HobbyComponents.com in your comments if you redistribute this code. //This code is modified by Ahlskog Niki & Borgström Anders //SENSOR PINOUT: #define FLAME_DETECT_ANA A0 // Select the input pin for the flame detectors analogue output. #define FLAME_DETC_DIO 2 // Select the input pin for the flame detectors digital output. int led = 8; // Select the input pin for the led void setup() // Initialize serial and DIO { Serial.begin(9600); // Setup the serial port for displaying the status of the sensor pinMode(led, OUTPUT); pinMode(FLAME_DETC_DIO, INPUT); // Configure the DIO pin the sensors digital output will be connected to } void loop() // Main program loop { Serial.print("Sensor Value: "); // Read the sensors analogue output and send it to the serial port Serial.print(analogRead(FLAME_DETECT_ANA)); delay(1000); if (!digitalRead(FLAME_DETC_DIO)) // Read the status of the sensors digital output and if it is high then send an alert to the UART and the led is lighten { Serial.println(" FLAME DETECTED!"); digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW); }else // Otherwise the there is no alert and the led is shut down { Serial.println(); digitalWrite(led, LOW); } }
دلیلش اینه ماژول سایت فقط D0 داره و این کد برای A0 D0 نوع دیگری 4 پایه ماژول هست نه 3 پایه
در نتیجه همیشه flame detected میده
که من یه delay اضافه کردم و قسمت digitalRead(FLAME_DETC_DIO) رو not کردم

توضیحات تکمیلی
کد:
How it works: The flame sensor is very sensitive to IR wavelength at 760 nm ~ 1100 nm light. Analog output (A0): Real-time output voltage signal on the thermal resistance. Digital output (D0): When the temperature reaches a certain threshold, the output high and low signal threshold adjustable via potentiometer
.