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
import RPi.GPIO as GPIO | |
from time import sleep | |
from firebase import firebase | |
import Adafruit_DHT | |
sensor = Adafruit_DHT.DHT11 | |
pin = 4 | |
firebase = firebase.FirebaseApplication('https://YOUR_FIREBASE_URL.firebaseio.com/', None) | |
firebase.put("/", "/temp", "0.00") |
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 <Wire.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_ADXL345_U.h> | |
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); | |
float val_x=0,val_y=0,val_z=0; | |
float sig_x=0,sig_y=0,sig_z=0; | |
float alpha=0.1; | |
void setup() | |
{ | |
Serial.begin(115200); |
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
double sig=0,alpha=0.2; | |
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
int val=analogRead(A0); | |
sig = (alpha*(double)val) + ((1.0-alpha)*sig); | |
Serial.print(val); | |
Serial.print(","); |
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.xxx" #IP of your Raspberry Pi | |
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 | |
print("connecting to broker ",broker) |
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 Adafruit_DHT | |
import paho.mqtt.client as paho | |
broker="192.168.xx.xxx" | |
sensor = Adafruit_DHT.DHT11 | |
pin = 4 | |
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) | |
def hum_temp(): |
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 paho.mqtt.client as paho | |
broker="192.168.x.xxx" #IP of your Raspberry Pi | |
#define callback | |
def on_message(client, userdata, message): | |
time.sleep(1) | |
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 sys | |
import RPi.GPIO as GPIO | |
import os | |
from time import sleep | |
import Adafruit_DHT | |
import urllib2 | |
DEBUG = 1 | |
# Setup the pins we are connect to | |
soilpin = 14 |
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 <ESP8266mDNS.h> | |
#include <WiFiUdp.h> | |
#include <ArduinoOTA.h> | |
// Replace with your network credentials | |
const char* ssid = "YOUR_SSID"; | |
const char* password = "YOUR_PASSWORD"; | |
const int ESP_BUILTIN_LED = D0; |
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> | |
#include <ESP8266NetBIOS.h> | |
const char* ssid = "............"; | |
const char* password = ".............."; | |
ESP8266WebServer wwwserver(80); | |
String content; |
NewerOlder