Here is the program.
Thanks
Bobby
//#include <genieArduino.h>
// When one of the 4D display panels goes bad or get disconnected, the other 2 do not work and update
// The problem is that the display panels loose the SYNC.
// So the <genieArduinoDEV.h> is added to fix the problem.
#include <genieArduinoDEV.h>
#include <SoftwareSerial.h> // need this to make the arrow part of color picker to work
/*
A350 CRC Touch Screen seating area Display Panel
This program is installed in the CRC Main COntroller.
This program uses Ardunio MEGA 2560 board along with 3 of the 4D system touch screen uLCD-32PTU
The Ardunio communnicates with 4D touch screens via serial ports 1, 2, 3
All touch screen display are used in the Seating area of the A350 CRC module.
Serial Port 0 is used to comunicate with the Alarm display panel to get
Smoke location and then send it to all the touch screen display panels
// Serial Port 0 is used to communicate with Alarm Display Panel
// Serial Port 1 is used to communicate with the 4D display #1
// Serial Port 2 is used to communicate with the 4D display #2
// Serial Port 3 is used to communicate with the 4D display #3
// Location of the Smoke comes from the Alarm Display Panel in form of 1 to 14 for the A350 CRC.
// And value of 20 is used for multiple fire locations
// These location is used here to show te location. Only these values should turn on the
// Smoke ICON on the main menu.
// OCTOBER 2023. ADDED AN IF STATEMENT FOR DISCRETE SMOKE INPUT. IF IT IS LOW THEN TUNR ON THE SMOKE
// ICON IN THE MAIN MENU OF THE SEATING AREA DISPLAY PANELS. IT ALSO TURNS THE SMOKE ON WHEN IT GETS
// MESSAGES FROM THE ALARM DISPLAY PANEL. BUT IT ALSO SHOULD TURN ON THE SMOKE ICON WHEN THE DISCRET
// SMOKE INPUT GOES LOW. REDUDENCY
// CHANGED TO SMOKE = 1 ON MARCH 2024
*/
Genie display1; // Genie Display 1
Genie display2; // Genie Display 2
Genie display3; // Genie Display 2
//Genie genie;
// Mood Lighting
int RED, GREEN, BLUE = 0;
int UP_WARD, LAV_OCP, LAV_DWR, CRC_DR, SMOKE, SMOKE1, VALVE_SW1, VALVE_SW2, LOW_AIR, HATCHES, C, HATCH1, HATCH2, CAB_RTN, BELT, CEILING, FLOOR;
int incomingByte, counter; // incoming serial data from Alarm display Panel providing Alarm Location
void setup()
{
// USe serial 0 to communicate to the Alarm Display Panel to get location of the Alarms
Serial.begin(9600);
Serial1.begin(9600); // Serial1 should match the speed set in the 4D display
display1.Begin(Serial1); // Use Serial0 for talking to the Genie Library, and to the 4D Systems display #1
Serial2.begin(9600); // Serial2 should match the speed set in the 4D display
display2.Begin(Serial2); // Use Serial1 for talking to the Genie Library, and to the 4D Systems display #2
Serial3.begin(9600); // Serial2 should match the speed set in the 4D display
display3.Begin(Serial3); // Use Serial1 for talking to the Genie Library, and to the 4D Systems display #2
display1.AttachEventHandler(myGenieEventHandler1); // Attach the user function Event Handler for processing events for display 1
display2.AttachEventHandler(myGenieEventHandler2); // Attach the user function Event Handler for processing events for display 2
display3.AttachEventHandler(myGenieEventHandler3); // Attach the user function Event Handler for processing events for display 2
/* This Touch screen reset function was removed because it causes all three touch screens to turn on
and then turn off and do not turn back on. it was worse when the Alarm Display panel
was powered On too. Some times they came on but the serial ports never could communicate
with MEGA2560. I think the problem started when I added #include <genieArduinoDEV.h>
This file syncs all the touch screen so the RESET function probably causes interference.
// Reset the Displays
// THIS IS IMPORTANT AND CAN PREVENT OUT OF SYNC ISSUES, SLOW SPEED RESPONSE ETC
pinMode(4, OUTPUT); // Set D4 on Arduino to Output to control the reset line to Display 1
pinMode(3, OUTPUT); // Set D2 on Arduino to Output to control the reset line to Display 2
pinMode(2, OUTPUT); // Set D2 on Arduino to Output to control the reset line to Display 2
digitalWrite(4, 1); // Reset Display 1
digitalWrite(3, 1); // Reset Display 1
digitalWrite(2, 1); // Reset Display 2
delay(100);
digitalWrite(4, 0); // unReset Display 1
digitalWrite(3, 0); // unReset Display 1
digitalWrite(2, 0); // unReset Display 2
*/
// Let the display start up after the reset (This is important)
// Increase to 4500 or 5000 if you have sync problems as your project gets larger. Can depent on microSD init speed.
delay (5000);
pinMode(22, INPUT);
pinMode(23, INPUT);
pinMode(24, INPUT);
pinMode(25, INPUT);
pinMode(26, INPUT);
pinMode(27, INPUT);
pinMode(28, INPUT);
pinMode(29, OUTPUT);
pinMode(30, INPUT);
pinMode(31, INPUT);
pinMode(32, INPUT);
pinMode(33, INPUT);
pinMode(34, INPUT);
pinMode(35, OUTPUT);
pinMode(36, OUTPUT);
pinMode(37, OUTPUT);
pinMode(52, OUTPUT); // TO CONTROL RTS ON THE RS485 MODULE LOCATED IN THE MAIN CONTROLLER
pinMode(53, OUTPUT); // TO CONTROL RTS ON THE RS485 LOCATED IN THE SEATING AREA DISPLAY PANELS. USING RESET WIRE.
// For Mood Lighting - Environmental RGB Lights are limited to 25 feet. more than that the colors dont work.
// So we need to channels - circuits
pinMode(7, OUTPUT); // green - pin 7
pinMode(6, OUTPUT); // blue color - pin 6
pinMode(5, OUTPUT); // for red color - pin 5
pinMode(11, OUTPUT); // green - pin 7
pinMode(10, OUTPUT); // blue color - pin 6
pinMode(9, OUTPUT); // for red color - pin 5
// Initialize
CEILING=0;
FLOOR=0;
SMOKE = 0;
counter = 0;
}
void loop()
{
display1.DoEvents(); // This calls the library each loop to process the queued responses from display 1
display2.DoEvents(); // This calls the library each loop to process the queued responses from display 2
display3.DoEvents(); // This calls the library each loop to process the queued responses from display 3
STATUS();
// genie.DoEvents(); //Here the messages are received and queued.
display1.DoEvents(); // This calls the library each loop to process the queued responses from display 1
display2.DoEvents(); // This calls the library each loop to process the queued responses from display 2
display3.DoEvents(); // This calls the library each loop to process the queued responses from display 3
if (Serial.available() > 0)
{
incomingByte = Serial.read();
}
}
/////////////////////////////////////////////////////////////////////
//
// This is the user's event handler. It is called by the DoEvents()
// when the following conditions are true
//
// The link is in an IDLE state, and
// There is an event to handle
//
// The event can be either a REPORT_EVENT frame sent asynchronously
// from the display or a REPORT_OBJ frame sent by the display in
// response to a READ_OBJ (genie.ReadObject) request.
//
// Event Handler Function for Display 1
void myGenieEventHandler1(void)
{
genieFrame Event;
display1.DequeueEvent(&Event); // Remove the next queued event from the buffer, and process it below
//If the cmd received is from a Reported Event (Events triggered from the Events tab of Workshop4 objects)
if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
{
if (Event.reportObject.object == GENIE_OBJ_WINBUTTON)// If the reported message is from a Winbutton
{
// Serial1.println(Event.reportObject.index); // Now we need to convert data to HEX
if (Event.reportObject.index == 0) // If the reported message is from Winbutton0
{
if (CEILING == 0)
{
digitalWrite(36, 1); //Turn On the Ceiling Lights
CEILING = 1; // Use to toggle On/Off
}
else
{
digitalWrite(36, 0); //Turn Off the Ceiling Lights
CEILING = 0;
}
}
if (Event.reportObject.index == 9) // If the reported message is from Winbutton9 - turn off Mood lighting
{
digitalWrite(35, 0); //Turn Off POWER FOR MOOD LIGHTING
}
if (Event.reportObject.index == 3) // If the reported message is from Winbutton3
{
digitalWrite(35, 0); //Added Turn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=255;
GREEN=0;
BLUE=0;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
//Channel 1
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 4) // If the reported message is from Winbutton4
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=255;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 2
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 11) // If the reported message is from Winbutton11
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=128;
BLUE=0;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 12) // If the reported message is from Winbutton12
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=0;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 18) // If the reported message is from Winbutton18
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=255;
GREEN=255;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
}
}
}
// Read input status of inputs and send out to seating display panels
void STATUS()
{
// GND is active for all these lines
UP_WARD = digitalRead(22); // Read status of pin 22 - WARDRUP SW NOT USED - NOT CONNECTED
LAV_OCP = digitalRead(23); // Read status of pin 23 - LAV OCCUPIED
HATCH1 = digitalRead(24); // Read status of pin 24 - HATCH1
HATCH2 = digitalRead(25); // Read status of pin 25 - HATCH2
SMOKE = digitalRead(26); // Read status of pin 26 - SMOKE. High IS SMOKE PRESENT
VALVE_SW1 = digitalRead(27); // Read status of pin 27 - SHUTOFF VALVE #1
VALVE_SW2 = digitalRead(28); // Read status of pin 28 - SHUTOFF VALVE #2
CAB_RTN = digitalRead(31); // Read status of pin 31 - Return to Cabin
BELT = digitalRead(32); // Read status of pin 32 - Fasten Seat Belt
// digitalWrite(52, 1); //SET RTS LOCATED IN THE MAIN CONTROLLER TO HI ON THE RS485 MODULE TO SEND DATA OUT
// digitalWrite(53, 0); //SET RTS LOCATED ON THE RS485 MODULE TO LOW IN THE DISPLAY PANELS IN THE SEATING AREA TO RECEIVE DATA
// Added October 2023. The SMOKE discrete coming from Alarm Display Panel
if (SMOKE == 1)
{
// Turn on the Smoke Icon
display1.WriteObject(GENIE_OBJ_USERIMAGES, 3, 1); //Write to Smoke Userimages3 shown in 4D display
display2.WriteObject(GENIE_OBJ_USERIMAGES, 3, 1); //Write to Smoke Userimages3 shown in 4D display
display3.WriteObject(GENIE_OBJ_USERIMAGES, 3, 1); //Write to Smoke Userimages3 shown in 4D display
}
else
{
// Turn off the Smoke Icon
display1.WriteObject(GENIE_OBJ_USERIMAGES, 3, 0); //Write to Smoke Userimages3 shown in 4D display
display2.WriteObject(GENIE_OBJ_USERIMAGES, 3, 0); //Write to Smoke Userimages3 shown in 4D display
display3.WriteObject(GENIE_OBJ_USERIMAGES, 3, 0); //Write to Smoke Userimages3 shown in 4D display
}
if (LAV_OCP == 1)
{
display1.WriteObject(GENIE_OBJ_USERIMAGES, 0, 0); //Write to Userimages0 shown in 4D display - Lavatory
display2.WriteObject(GENIE_OBJ_USERIMAGES, 0, 0); //Write to Userimages0 shown in 4D display - Lavatory
display3.WriteObject(GENIE_OBJ_USERIMAGES, 0, 0); //Write to Userimages0 shown in 4D display - Lavatory
}
else
{
display1.WriteObject(GENIE_OBJ_USERIMAGES, 0, 1); //Write to Userimages0 shown in 4D display - Lavatory
display2.WriteObject(GENIE_OBJ_USERIMAGES, 0, 1); //Write to Userimages0 shown in 4D display - Lavatory
display3.WriteObject(GENIE_OBJ_USERIMAGES, 0, 1); //Write to Userimages0 shown in 4D display - Lavatory
}
if (CAB_RTN == 0)
{
display1.WriteStr(2, " "); // Send string 2 to 4D touch screen
display2.WriteStr(2, " "); // Send string 2 to 4D touch screen
display3.WriteStr(2, " "); // Send string 2 to 4D touch screen
}
else
{
display1.WriteStr(2, "Return to Cabin"); // Send string 2 to 4D touch screen
display2.WriteStr(2, "Return to Cabin"); // Send string 2 to 4D touch screen
display3.WriteStr(2, "Return to Cabin"); // Send string 2 to 4D touch screen
}
if (BELT == 0)
{
display1.WriteObject(GENIE_OBJ_USERIMAGES, 1, 0); //Write to Userimages1 shown in 4D display - FasteN Belt
display2.WriteObject(GENIE_OBJ_USERIMAGES, 1, 0); //Write to Userimages1 shown in 4D display - FasteN Belt
display3.WriteObject(GENIE_OBJ_USERIMAGES, 1, 0); //Write to Userimages1 shown in 4D display - FasteN Belt
}
else
{
display1.WriteObject(GENIE_OBJ_USERIMAGES, 1, 1); //Write to Userimages1 shown in 4D display - Faster Belt
display2.WriteObject(GENIE_OBJ_USERIMAGES, 1, 1); //Write to Userimages1 shown in 4D display - Faster Belt
display3.WriteObject(GENIE_OBJ_USERIMAGES, 1, 1); //Write to Userimages1 shown in 4D display - Faster Belt
}
// Send data to display #1
display1.WriteObject(GENIE_OBJ_USER_LED, 0, LAV_OCP); //Write to userled1 of the 4D display -
display1.WriteObject(GENIE_OBJ_USER_LED, 1, HATCH1); //Write to userled1 of the 4D display -
display1.WriteObject(GENIE_OBJ_USER_LED, 2, VALVE_SW1); //Write to userled1 of the 4D display -
display1.WriteObject(GENIE_OBJ_USER_LED, 3, VALVE_SW2); //Write to userled1 of the 4D display -
display1.WriteObject(GENIE_OBJ_USER_LED, 4, HATCH2); //Write to userled1 of the 4D display -
display1.WriteObject(GENIE_OBJ_USER_LED, 5, SMOKE); //Write to userled1 of the 4D display -
// Send data to display #2
display2.WriteObject(GENIE_OBJ_USER_LED, 0, LAV_OCP); //Write to userled1 of the 4D display -
display2.WriteObject(GENIE_OBJ_USER_LED, 1, HATCH1); //Write to userled1 of the 4D display -
display2.WriteObject(GENIE_OBJ_USER_LED, 2, VALVE_SW1); //Write to userled1 of the 4D display -
display2.WriteObject(GENIE_OBJ_USER_LED, 3, VALVE_SW2); //Write to userled1 of the 4D display -
display2.WriteObject(GENIE_OBJ_USER_LED, 4, HATCH2); //Write to userled1 of the 4D display -
display2.WriteObject(GENIE_OBJ_USER_LED, 5, SMOKE); //Write to userled1 of the 4D display -
// Send data to display #3
display3.WriteObject(GENIE_OBJ_USER_LED, 0, LAV_OCP); //Write to userled1 of the 4D display -
display3.WriteObject(GENIE_OBJ_USER_LED, 1, HATCH1); //Write to userled1 of the 4D display -
display3.WriteObject(GENIE_OBJ_USER_LED, 2, VALVE_SW1); //Write to userled1 of the 4D display -
display3.WriteObject(GENIE_OBJ_USER_LED, 3, VALVE_SW2); //Write to userled1 of the 4D display -
display3.WriteObject(GENIE_OBJ_USER_LED, 4, HATCH2); //Write to userled1 of the 4D display -
display3.WriteObject(GENIE_OBJ_USER_LED, 5, SMOKE); //Write to userled1 of the 4D display -
}
//
// Event Handler Function for Display 2
void myGenieEventHandler2(void)
{
genieFrame Event;
display2.DequeueEvent(&Event); // Remove the next queued event from the buffer, and process it below
//If the cmd received is from a Reported Event (Events triggered from the Events tab of Workshop4 objects)
if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
{
if (Event.reportObject.object == GENIE_OBJ_WINBUTTON)// If the reported message is from a Winbutton
{
if (Event.reportObject.index == 0) // If the reported message is from Winbutton0
{
if (CEILING == 0)
{
digitalWrite(36, 1); //Turn On the Ceiling Lights
CEILING = 1; // Use to toggle On/Off
}
else
{
digitalWrite(36, 0); //Turn Off the Ceiling Lights
CEILING = 0;
}
}
if (Event.reportObject.index == 9) // If the reported message is from Winbutton9 - turn off Mood lighting
{
digitalWrite(35, 0); //Turn Off POWER FOR MOOD LIGHTING
}
if (Event.reportObject.index == 3) // If the reported message is from Winbutton3
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=255;
GREEN=0;
BLUE=0;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 4) // If the reported message is from Winbutton4
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=255;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 2
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 11) // If the reported message is from Winbutton11
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=128;
BLUE=0;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 12) // If the reported message is from Winbutton12
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=0;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 18) // If the reported message is from Winbutton18
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=255;
GREEN=255;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
}
}
}
// Event Handler Function for Display 3
void myGenieEventHandler3(void)
{
genieFrame Event;
display3.DequeueEvent(&Event); // Remove the next queued event from the buffer, and process it below
//If the cmd received is from a Reported Event (Events triggered from the Events tab of Workshop4 objects)
if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
{
if (Event.reportObject.object == GENIE_OBJ_WINBUTTON)// If the reported message is from a Winbutton
{
// Serial3.println(Event.reportObject.index); // Now we need to convert data to HEX
if (Event.reportObject.index == 0) // If the reported message is from Winbutton0
{
if (CEILING == 0)
{
digitalWrite(36, 1); //Turn On the Ceiling Lights
CEILING = 1; // Use to toggle On/Off
}
else
{
digitalWrite(36, 0); //Turn Off the Ceiling Lights
CEILING = 0;
}
}
if (Event.reportObject.index == 9) // If the reported message is from Winbutton9 - turn off Mood lighting
{
digitalWrite(35, 0); //Turn Off POWER FOR MOOD LIGHTING
}
if (Event.reportObject.index == 3) // If the reported message is from Winbutton3
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=255;
GREEN=0;
BLUE=0;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 4) // If the reported message is from Winbutton4
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=255;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 2
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 11) // If the reported message is from Winbutton11
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=128;
BLUE=0;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 12) // If the reported message is from Winbutton12
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=0;
GREEN=0;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
if (Event.reportObject.index == 18) // If the reported message is from Winbutton18
{
digitalWrite(35, 0); //AddedcTurn Off POWER FOR MOOD LIGHTING
delay (2000);
RED=255;
GREEN=255;
BLUE=255;
digitalWrite(35, 1); //Turn On POWER FOR MOOD LIGHTING
analogWrite(5, RED); // Turn On the mood lighting color 1
analogWrite(7, GREEN);
analogWrite(6, BLUE);
//Channel 2
analogWrite(9, RED); // Turn On the mood lighting color 1
analogWrite(11, GREEN);
analogWrite(10, BLUE);
}
}
}
}
Seating_Displays.ino (56.7 KB)