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
void setup() { | |
// initialize digital pin LED_BUILTIN as an output. | |
pinMode(LED_BUILTIN, OUTPUT); | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(1000); // wait for a second | |
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW | |
delay(1000); // wait for a second |
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
const int trigPin = 2; //D4 | |
const int echoPin = 0; //D3 | |
long duration;\\defining variable duration to hold the duration of the reflected wave | |
int distance;\\defining variable distance to hold the distance of the object from the sensor | |
void setup() { | |
pinMode(2, OUTPUT); // Sets the trigPin as an Output | |
pinMode(0, INPUT); // Sets the echoPin as an Input | |
Serial.begin(9600); // Starts the serial communication with baud rate 9600 |
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
int shockPin = 10; // Use Pin 10 as our Input | |
int shockVal = HIGH; // This is where we record our shock measurement | |
boolean bAlarm = false; | |
unsigned long lastShockTime; // Record the time that we measured a shock | |
int shockAlarmTime = 250; // Number of milli seconds to keep the shock alarm high | |
void setup () |
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 "DHT.h" | |
#define dht_apin A0 // Analog Pin sensor is connected to | |
dht DHT; | |
void setup(){ | |
Serial.begin(9600); | |
delay(500);//Delay to let system boot | |
Serial.println("DHT11 Humidity & temperature Sensor\n\n"); |
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
int led = 13;//LED pin | |
int sensor = 3; //sensor pin | |
int val; //numeric variable | |
void setup() | |
{ | |
pinMode(led, OUTPUT); //set LED pin as output | |
pinMode(sensor, INPUT); //set sensor pin as input | |
} |
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
int Buzzer = 13; // Use buzzer for alert | |
int FlamePin = 2; // This is for input pin | |
int Flame = HIGH; // HIGH when FLAME Exposed | |
void setup() { | |
pinMode(Buzzer, OUTPUT); | |
pinMode(FlamePin, INPUT); | |
Serial.begin(9600); | |
} |
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
int sensorPin = A0; // Pulse Sensor connected to ANALOG PIN 0 | |
int led = 13; // The on-board Arduino LED | |
int Signal; // holds the incoming raw data. Signal value can range from 0-1023 | |
int Threshold = 550; // Determine which Signal to “count as a beat”, and which to ingore. | |
// The SetUp Function: | |
void setup() { | |
pinMode(sensorPin,INPUT); | |
pinMode(led,OUTPUT); // pin that will blink to your heartbeat! | |
Serial.begin(9600); // Set’s up Serial Communication at certain speed. | |
} |
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 <ArduinoJson.h> | |
void setup() { | |
// Initialize Serial port | |
Serial.begin(9600); | |
while (!Serial) continue; | |
// Memory pool for JSON object tree. | |
// | |
// Inside the brackets, 200 is the size of the pool in bytes. |
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 <ESP8266HTTPClient.h> | |
void setup () { | |
Serial.begin(115200); //Begin Serial Communication with NodeMCU | |
const char* ssid = "Your router name"; | |
const char* password = "Your router password"; | |
WiFi.begin(ssid, password); //Connect to WiFi |
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 = "YourNetworkName"; | |
const char* password = "YourNetworkPassword"; | |
const char* mqttServer = "m11.cloudmqtt.com"; | |
const int mqttPort = 12948; //your port number | |
const char* mqttUser = "YourMqttUser"; | |
const char* mqttPassword = "YourMqttUserPassword"; | |