Loading...
Loading...
// Smoke Generator Controller
const int SMOKE_PIN = 9;
const int BUTTON = 2;
const int LED = 13;
const int SMOKE_TIME = 5000; // 5 seconds
const int PAUSE_TIME = 30000; // 30 seconds
void setup() {
pinMode(SMOKE_PIN, OUTPUT);
pinMode(BUTTON, INPUT_PULLUP);
pinMode(LED, OUTPUT);
}
void activateSmoke() {
digitalWrite(SMOKE_PIN, HIGH);
digitalWrite(LED, HIGH);
delay(SMOKE_TIME);
digitalWrite(SMOKE_PIN, LOW);
digitalWrite(LED, LOW);
}
void loop() {
if (digitalRead(BUTTON) == LOW) {
activateSmoke();
}
// Auto cycle
activateSmoke();
delay(PAUSE_TIME);
}This is starter code - modify and expand for your specific needs.
Before building this project, make sure you have the Arduino IDE installed and are comfortable uploading basic sketches to your board.
Most projects use standard Arduino libraries. Some may require additional libraries like AccelStepper, Servo, or NmraDcc - install these through the Arduino Library Manager.