This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
## webbot code modified by Shijaz Abdulla - www.awsomenow.com | |
## See the original project on GitHub: https://github.com/picymru/webbot | |
## This code is referenced in http://www.awsomenow.com/2018/07/06/building-a-robot-with-computer-vision-and-speech/ | |
## | |
# Some of the code that controls the robot's movement is from the Webbot project by PiCymru. Including their copyright notice. | |
## | |
# Copyright (c) 2016 PiCymru | |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<body> | |
<div id="headWrapper"><h1>Robot Control Terminal</h1></div> | |
<div class="wrapper"> | |
<div class="updownBtn"><button class="btn" onmousedown="robotMove(1)">Forward</button></div> | |
<div class="leftrightBtn"><button class="btn" onmousedown="robotMove(4)">Left</button></div> | |
<div class="leftrightBtn"><button class="btn" onmousedown="robotMove(2)">Right</button></div> | |
<div class="updownBtn"><button class="btn" onmousedown="robotMove(3)">Reverse</button></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lambda_function.py for AWS Lambda function - 'MoveRobot' | |
# Shijaz Abdulla - www.awsomenow.com | |
import os | |
import logging | |
import shadow_updater | |
# Get Environment Variables | |
clientId = os.environ.get('AWS_IOT_MQTT_CLIENT_ID') | |
thingName = os.environ.get("AWS_IOT_THING_NAME") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shadow_updater.py for Lambda function 'MoveRobot' | |
# Updates the AWS IOT Shadow for the robot | |
# Shijaz Abdulla - www.awsomenow.com | |
import os | |
import time | |
import json | |
import boto3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lambda_function.py for the Lambda Function 'SeeRobot' | |
# Shijaz Abdulla - www.awsomenow.com | |
import os | |
import logging | |
import shadow_updater | |
# Get the environment variables | |
clientId = os.environ.get('AWS_IOT_MQTT_CLIENT_ID') | |
thingName = os.environ.get("AWS_IOT_THING_NAME") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shadow_updater.py for the Lambda Function 'SeeRobot' | |
# Updates the AWS IOT Shadow for the robot | |
# Shijaz Abdulla - www.awsomenow.com | |
import os | |
import time | |
import json | |
import boto3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shadow_listener.py - Looks for messages on the device shadow using MQTT and performs actions (move and see) | |
# Copyright (C) 2019 Shijaz Abdulla - www.awsomenow.com | |
#This bit runs on the RPi | |
import os, logging, subprocess, time, argparse, datetime | |
from bottle import route, request, response, redirect, hook, error, default_app, view, static_file, template, HTTPError | |
from gpiozero import CamJamKitRobot | |
import datetime, pygame, ssl | |
import paho.mqtt.client as mqtt | |
#from picamera import PiCamera |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import uuid | |
import json | |
import random | |
import os | |
USERNAME = 'your_kasa_user@email.com' | |
PASSWORD = os.environ['PASSWORD'] # not ideal but there aren't many options | |
def SwitchOn(): |