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
{
"name": "Gas Sensor",
"description": "Gas Sensor",
"deviceTypeId": "654d7ef928f14e9ac82ad57d",
"capabilities": [
{
"id": "5ff0b41b994fd31b7d5e8961",
"mode": {
"instanceId": "modeInstance1",
"locale": "en-US",
#if defined(ESP8266)
const int adcPin = A0;
#elif defined(ESP32)
const int adcPin = 34;
#elif defined(ARDUINO_ARCH_RP2040)
const int adcPin = 26;
#endif
int sensorVal;
#ifndef _AIRQUALITYSENSOR_H_
#define _AIRQUALITYSENSOR_H_
#include <SinricProDevice.h>
#include <Capabilities/ModeController.h>
#include <Capabilities/RangeController.h>
#include <Capabilities/PushNotification.h>
class AirQualitySensor
: public SinricProDevice
{
"name": "Air Quality Sensor",
"description": "Air Quality Sensor",
"deviceTypeId": "5ff0b112994fd31b7d5e8065",
"capabilities": [
{
"id": "5ff0b41b994fd31b7d5e8961",
"mode": {
"instanceId": "modeInstance1",
"locale": "en-US",
#include <TroykaMQ.h> // https://github.com/amperka/TroykaMQ
#if defined(ESP8266)
#define SENSOR_PIN A0
#elif defined(ESP32)
#define SENSOR_PIN 34
#endif
MQ135 mq135(SENSOR_PIN);
#include <TroykaMQ.h> // https://github.com/amperka/TroykaMQ
#if defined(ESP8266)
#define SENSOR_PIN A0
#elif defined(ESP32)
#define SENSOR_PIN 34
#endif
MQ135 mq135(SENSOR_PIN);
// 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