Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Gabriel Alejandro Giraldo Santiago
Published © GPL3+

Simulation of a Domotic System of Lights

We are going to build a scale model to demonstrate the operation of light control through Bluetooth with Arduino.

BeginnerFull instructions provided2 hours1,825
Simulation of a Domotic System of Lights

Things used in this project

Story

Read more

Custom parts and enclosures

Blueprints

Example of Blueprints

Schematics

Blueprints

Blueprints 1

Blueprints 2

Code

CODE

C/C++
void setup() {
Serial.begin(9600);
pinMode(8, OUTPUT);// put your setup code here, to run once:
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
}
 
void loop() {
  // put your main code here, to run repeatedly:
 if(Serial.available()>0)
   {     
      char data= Serial.read(); // reading the data received from the bluetooth module
      switch(data)
      {
        case 'a': digitalWrite(8, HIGH);break; // when a is pressed on the app on your smart phone
        case 'b': digitalWrite(8, LOW);break; // when d is pressed on the app on your smart phone
        default : break;
      }
      Serial.println(data);
   }
   delay(50);

 if(Serial.available()>0)
   {     
      char data= Serial.read(); // reading the data received from the bluetooth module
      switch(data)
      {
        case 'c': digitalWrite(9, HIGH);break; // when a is pressed on the app on your smart phone
        case 'd': digitalWrite(9, LOW);break; // when d is pressed on the app on your smart phone
        default : break;
      }
      Serial.println(data);
   }
   delay(50);

 if(Serial.available()>0)
   {     
      char data= Serial.read(); // reading the data received from the bluetooth module
      switch(data)
      {
        case 'e': digitalWrite(10, HIGH);break; // when a is pressed on the app on your smart phone
        case 'f': digitalWrite(10, LOW);break; // when d is pressed on the app on your smart phone
        default : break;
      }
      Serial.println(data);
   }
   delay(50);

 if(Serial.available()>0)
   {     
      char data= Serial.read(); // reading the data received from the bluetooth module
      switch(data)
      {
        case 'g': digitalWrite(11, HIGH);break; // when a is pressed on the app on your smart phone
        case 'h': digitalWrite(11, LOW);break; // when d is pressed on the app on your smart phone
        default : break;
      }
      Serial.println(data);
   }
   delay(50);
}

Credits

Gabriel Alejandro Giraldo Santiago
13 projects • 86 followers
Seeed Ranger, AI and Computer Vision expert for key industries. Mentor and speaker on AI, startups, and no-code. Maker enthusiast.

Comments