Rajesh
Published © GPL3+

Light Control Using Arduino and Amazon Alexa

Control a light using Amazon skill kit and Arduino!

IntermediateFull instructions provided1 hour28,190
Light Control Using Arduino and Amazon Alexa

Things used in this project

Story

Read more

Schematics

RPiArduino

ArduinoLed

Code

RPiArduino

Python
from flask import Flask
from flask_ask import Ask, statement
import requests
import json
import serial

ser = serial.Serial("/dev/ttyACM0", 9600)

app = Flask(__name__)
ask = Ask(app, '/')

@ask.launch

@ask.intent("LightOn")
def on():
    ser.write(b'N')
    return statement("Hall light turned on.")

@ask.intent("LightOff")
def off():
    ser.write(b'F')
    return statement("Hall light turned off.")

if __name__ == "__main__":
    app.run(debug=True)

ArduinoLed

Arduino
int led = 13;

void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);
    Serial.begin(9600);

  
}

void loop() {
  if (Serial.read() == 'N') {
     digitalWrite(led, HIGH);
  }else if(Serial.read() == 'F') {
     digitalWrite(led, LOW);
  }

  
 }

Credits

Rajesh

Rajesh

1 project • 10 followers

Comments