0% found this document useful (0 votes)
13 views2 pages

Arduino

Uploaded by

pakundosantos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Arduino

Uploaded by

pakundosantos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

// Define the pins for the LEDs

const int machine1LED = 2;

const int machine2LED = 3;

const int machine3LED = 4;

// Define the timing constants in milliseconds

const unsigned long loadingTime = 340; // 0.34 minutes = 340 ms

const unsigned long unloadingTime = 260; // 0.26 minutes = 260 ms

const unsigned long walkTime = 60; // 0.06 minutes = 60 ms

const unsigned long powerFeedTime = 1480; // 1.48 minutes = 1480 ms

void setup() {

// Initialize the LED pins as outputs

pinMode(machine1LED, OUTPUT);

pinMode(machine2LED, OUTPUT);

pinMode(machine3LED, OUTPUT);

void handleMachine(int machineLED) {

// Simulate loading the machine

digitalWrite(machineLED, HIGH); // Turn on LED to indicate loading

delay(loadingTime); // Wait for loading time

// Simulate power feed time (machine working)

delay(powerFeedTime); // Wait for power feed time

// Simulate unloading the machine

delay(unloadingTime); // Wait for unloading time

digitalWrite(machineLED, LOW); // Turn off LED to indicate unloading


// Simulate walk time to next machine

delay(walkTime); // Wait for walk time

void loop() {

// Handle each machine in sequence

handleMachine(machine1LED);

handleMachine(machine2LED);

handleMachine(machine3LED);

You might also like