Tinker Project
Published

Arduino-Powered Smart Light (Works with Amazon Echo)

Build your own Arduino-powered light switch that can be controlled using Amazon Alexa.

IntermediateFull instructions provided40,309
Arduino-Powered Smart Light (Works with Amazon Echo)

Things used in this project

Story

Read more

Schematics

Circuit

Code

Arduino Nano Code

Arduino
int light = 4; // Light Connected to digital pin 4
void setup()
{
  pinMode(light, OUTPUT);
  Serial.begin(115200);
  while (!Serial);
}

void loop() {
  if (Serial.available())
  {
    int state = Serial.parseInt(); //Convert serial data to int 
    if (state == 1)   
    {
      digitalWrite(light, HIGH); // When state is 1 turn on the Light 
    }
    if (state == 0)
    {
      digitalWrite(light, LOW); // When state is 0 turn off the Light
    }
  }
}

Credits

Tinker Project

Tinker Project

2 projects • 17 followers
I make DIY and IoT related Projects.

Comments