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
#Store number features in variables | |
redcolor=0 | |
orangecolor=1 | |
smooth=0 | |
rough=1 | |
apple=0 | |
orange=1 | |
#Put all data points in an array - features and labels in seperate arrays | |
features=[[redcolor,smooth],[orangecolor,rough],[redcolor,smooth], |
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
#include <ESP8266WiFi.h> | |
#include <ESP8266WebServer.h> //Library to handle Web Server commands | |
#include <WiFiClient.h> | |
int irpin = D1; | |
int buzzerPin = D2; | |
ESP8266WebServer server(80); //Declare a server object |
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
String name = ""; | |
String Mobile = ""; | |
String Address = ""; | |
String Email = ""; | |
void setup() { | |
Serial.begin(9600); //starting the data transfer at 9600 baud rate | |
} | |
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
from Adafruit_IO import MQTTClient | |
import RPi.GPIO as IO | |
ADAFRUIT_IO_USERNAME = "xxxxxxxxxx" | |
ADAFRUIT_IO_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
IO.setwarnings(False) | |
IO.setmode(IO.BOARD) | |
IO.setup(11,IO.OUT) |
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
from twilio.rest import Client | |
# Your Account Sid and Auth Token from twilio.com/console | |
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
auth_token = 'your_auth_token' | |
client = Client(account_sid, auth_token) | |
message = client.messages \ | |
.create( |
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
from twilio.rest import Client | |
# Your Account Sid and Auth Token from twilio.com/console | |
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
auth_token = 'your_auth_token' | |
client = Client(account_sid, auth_token) | |
message = client.messages \ |
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
#include <ESP8266WiFi.h> | |
#include <PubSubClient.h> | |
const char* ssid = "YOUR_SSID"; | |
const char* password = "YOUR_PASSWORD"; | |
const char* mqtt_server = "192.168.XX.XXX";// Your Raspberry Pi IP address | |
WiFiClient espClient; | |
PubSubClient client(espClient); | |
long lastMsg = 0; |
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 paho.mqtt.client as paho | |
broker="192.168.xx.xx" #IP of your Raspberry Pi | |
#define callback | |
def on_message(client, userdata, message): | |
print("received message =",str(message.payload.decode("utf-8"))) | |
client= paho.Client("client-001") | |
client.on_message=on_message |
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 time | |
import Adafruit_SSD1306 | |
from PIL import Image | |
# Raspberry Pi pin configuration: | |
RST = 24 | |
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST) |
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 time | |
import Adafruit_ADXL345 | |
accel = Adafruit_ADXL345.ADXL345() | |
print('Printing X, Y, Z axis values, press Ctrl-C to quit...') | |
while True: | |
# Read the X, Y, Z axis acceleration values and print them. | |
x, y, z = accel.read() | |
print('X={0}, Y={1}, Z={2}'.format(x, y, z)) |
NewerOlder