Skip to content

Instantly share code, notes, and snippets.

View kakopappa's full-sized avatar
🏠
Working from home

Aruna Tennakoon kakopappa

🏠
Working from home
View GitHub Profile
// Uncomment the following line to enable serial debug output
//#define ENABLE_DEBUG
#ifdef ENABLE_DEBUG
#define DEBUG_ESP_PORT Serial
#define NODEBUG_WEBSOCKETS
#define NDEBUG
#endif
#include <Arduino.h>
#if defined(ESP8266)
#define BUTTON_PIN D4
#elif defined(ESP32)
#define BUTTON_PIN 34
#elif (ARDUINO_ARCH_RP2040)
#define BUTTON_PIN 7
#endif
int button_state;
int lastbutton_state = LOW;
#if defined(ESP8266)
const int sPin = A0;
const int vccPin = D2;
#elif defined(ESP32)
const int sPin = 34;
const int vccPin = 17;
#elif defined(ARDUINO_ARCH_RP2040)
const int sPin = 26;
const int vccPin = 6;
#endif
#if defined(ESP8266)
const int sPin = A0;
const int vccPin = D2;
#elif defined(ESP32)
const int sPin = 34;
const int vccPin = 17;
#elif defined(ARDUINO_ARCH_RP2040)
const int sPin = 26;
const int vccPin = 6;
#endif
#if defined(ESP8266)
const int sPin = A0;
const int vccPin = D2;
#elif defined(ESP32)
const int sPin = 34;
const int vccPin = 17;
#elif defined(ARDUINO_ARCH_RP2040)
const int sPin = 26;
const int vccPin = 6;
#endif
{
"name": "Flood Sensor",
"description": "Flood Sensor",
"deviceTypeId": "65335c897dc29736db4272d2",
"capabilities": [
{
"id": "5ff0b41b994fd31b7d5e8961",
"mode": {
"instanceId": "modeInstance1",
"locale": "en-US",
#ifndef _FLOODSENSOR_H_
#define _FLOODSENSOR_H_
#include <SinricProDevice.h>
#include <Capabilities/ModeController.h>
#include <Capabilities/RangeController.h>
#include <Capabilities/PushNotification.h>
class FloodSensor
: public SinricProDevice
#include "max6675.h" // From https://github.com/adafruit/MAX6675-library
int CS0 = 11; // CS pin of MAX6675
int SO = 12; // SO pin of MAX6675
int SCK = 13; // SCK pin of MAX6675
int units = 0; // Units to readout temp (0 = ÀöF, 1 = ÀöC)
float error = 0.0; // Temperature compensation error
MAX6675 temp0(CS0,SO,SCK,units,error);
@kakopappa
kakopappa / Water Level Indicator.json
Created October 16, 2023 10:09
Water Level Indicator
{
"name": "Water Level Indicator",
"description": "Water Level Indicator",
"deviceTypeId": "621b9648f728ec974aac62f2",
"capabilities": [
{
"id": "5ff0b45f994fd31b7d5e89c2",
"range": {
"instanceId": "rangeInstance1",
"locale": "en-US",
#if defined(ESP8266)
const int trigPin = 12;
const int echoPin = 14;
#elif defined(ESP32)
const int trigPin = 5;
const int echoPin = 18;
#elif defined(ARDUINO_ARCH_RP2040)
const int trigPin = 15;
const int echoPin = 14;
#endif