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 pinValue=A0;//declaring analog pin as pinValue | |
void setup() { | |
Serial.begin(9600);//setting baud rate to 9600 | |
pinMode(4,OUTPUT);//declaring GPIO4 as output | |
} | |
void loop() { | |
int x=analogRead(pinValue);//taking values from the sensor to the variable x | |
Serial.println(x);//printing the sensor value onto the serial monitor | |
delay(500); |
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"; | |
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> | |
const char* ssid = "Network"; | |
const char* password = "nononono"; | |
int wifiStatus; | |
void setup() { | |
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
#include <EEPROM.h> | |
void setup() | |
{ | |
Serial.begin(9600); | |
uint addr = 0; | |
struct { | |
uint val = 0; |
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
// defines pins numbers | |
const int trigPin = 2; //D4 | |
const int echoPin = 0; //D3 | |
// defines variables | |
long duration; | |
int distance; | |
void setup() { | |
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output |
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 "DHT.h" // DHT11 temperature and humidity sensor Predefined library | |
#define DHTTYPE DHT11 // DHT 11 | |
#define dht_dpin 0 //GPIO-0 D3 pin of nodemcu | |
const char* ssid = "Your SSID"; | |
const char* password = "Your Wifi Password"; |
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 ldr = A0; //Analog pin from LDR | |
int ledPin=11; //Digital Pin to LED | |
int ldrValue; | |
void setup() { | |
pinMode(ldr,INPUT); | |
pinMode(ledPin,OUTPUT); | |
Serial.begin(9600); //Start the Serial communication and set rate to 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
// the setup function runs once when you press reset or power the board | |
void setup() { | |
pinMode(13, OUTPUT); // Set pin 13 as an OUTPUT pin | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(13, HIGH); // turn the LED ON | |
delay(1000); // waits for a second | |
digitalWrite(13, LOW); // turn the LED OFF |
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
float temp; //Declare temp variable of type float | |
int tempPin =A 0; //The analog pin of LM35 is connected to this analog input pin of Arduino, here it is connected to A0 | |
void setup() | |
{ | |
Serial.begin(9600); //Sets data rate for serial transmission between the Arduino and the computer |
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 ledPin = 13;const int ldrPin = A0;void setup() { | |
Serial.begin(9600); | |
pinMode(ledPin, OUTPUT); | |
pinMode(ldrPin, INPUT); | |
} |