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 <Arduino.h> | |
#include <ESP8266WiFi.h> | |
#include <Cloud4RPi.h> | |
#include "DHT.h" | |
#ifndef LED_BUILTIN | |
#define LED_BUILTIN 2 | |
#endif | |
#define DHTPIN 2 // Digital pin connected to the DHT sensor |
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 traceback | |
import time | |
import json | |
from urllib.request import Request, urlopen | |
from urllib.error import URLError, HTTPError | |
import RPi.GPIO as GPIO | |
import cloud4rpi | |
from hcsr04sensor import sensor |
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
# -*- coding: utf-8 -*- | |
# The DS18B20 sensor should be connected as follows: | |
# | |
# / GND |────────────> GND | |
# | DATA |─────────┬──> GPIO4 | |
# \ VCC |─┬─[4k7]─┘ | |
# └──────────> 5V | |
# DS18B20 (bottom view) | |
# |
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 <Arduino.h> | |
#include <ESP8266WiFi.h> | |
#include <Cloud4RPi.h> | |
const String deviceToken = "__YOUR__DEVICE_TOKEN__"; | |
char wifiSSID[] = "__SSID__"; | |
char wifiPassword[] = "__PASSWORD__"; | |
void ensureWiFiConnection(); |
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
# -*- coding: utf-8 -*- | |
from time import sleep | |
from socket import gethostname | |
import cloud4rpi | |
# Put your device token here. To get the token, | |
# sign up at https://cloud4rpi.io and create a device. | |
DEVICE_TOKEN = '__YOUR_DEVICE_TOKEN__' |
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
# -*- coding: utf-8 -*- | |
import sys | |
import time | |
import cloud4rpi | |
import rpi | |
import Adafruit_DHT | |
# Put your device token here. To get the token, | |
# sign up at https://cloud4rpi.io and create a device. |
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
#!/bin/bash | |
readonly PYTHON_PATH=/usr/bin/python3 | |
readonly SERVICE_NAME=cloud4rpi | |
quit_on_error() { | |
test "0" = $? || { | |
exit 1 | |
} | |
} |
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
# -*- coding: utf-8 -*- | |
from time import sleep | |
import sys | |
import cloud4rpi | |
# these functions will be called by device when sending data | |
def room_temp(): | |
return 25 |