Home Appliance system User Interface

Hi, I need help on how to go about this project. I am planning on writing just the user interface for a home automation which turns the lights on if off and vice versa. It should also let the user control the brightness of the light ( shown using numbers on the lcd display). Can someone help me out with this?

I am using an arduino uno and an adafruit lcd display.
Here is the code I have written as of now (I am still very new to this and this is shabby as hell so please help me out) -

#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// defining a data structure for the lights

struct Light {
bool state; // light is on or off
unsigned long timer; // how long the light has been on or off for
unsigned long brightness; // how bright the light is
void setup() {
// put your setup code here, to run once:


void loop() {
// put your main code here, to run repeatedly:
int b = lcd.readButtons();
lightBedroom.state = true;
lightBedroom.timer = millis();
static bool state = state;
// switching light off
if (state & b & BUTTON_DOWN){
// switching light on
if(lightBedroom.state = false & b & BUTTON_UP) {


What do you need help with ?

  static bool state = state;  //What is this intended to do ?

Please Auto format your code in the IDE, use Copy for forum in the IDE and paste it here so that it is code tags to make it easier to read and copy for examination

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.