O Level Exam : Practical Question
📝 HTML
🎨 CSS
⚡ Java Script
void setup() { pinMode(10, OUTPUT); pinMode(A5, INPUT); Serial.begin(9600); } void loop() { int sensor_read = analogRead(A5); if (sensor_read > 60) { Serial.print("Gas Sensor Value:"); Serial.println(sensor_read); tone(10,500, 100); //piezo rings } else { noTone(10); //peizo wont ring } delay(50); }
▶ Run Code
🖥 Output: