Skip to content

Instantly share code, notes, and snippets.

View arduitronics's full-sized avatar

arduitronics

View GitHub Profile
#include <SoftwareSerial.h>
SoftwareSerial pmsSerial(2, 3);
void setup() {
// our debugging output
Serial.begin(115200);
// sensor baud rate is 9600
pmsSerial.begin(9600);
}
struct pms5003data {
uint16_t framelen;
// On Leonardo/Micro or others with hardware serial, use those!
// uncomment this line:
// #define pmsSerial Serial1
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (TX pin on sensor), leave pin #3 disconnected
// comment these two lines if using hardware serial
#include <SoftwareSerial.h>
SoftwareSerial pmsSerial(2, 3);
void setup() {
// our debugging output
@arduitronics
arduitronics / connectwithWEP.inp
Last active October 23, 2019 14:11
ไฟล์ตัวอย่างของ arduino wifi rev2 เพื่อใช้ในการทดสอบการต่อ network : https://www.arduitronics.com/article/action/editarticle/70
/*
This example connects to a WEP-encrypted Wifi network.
Then it prints the MAC address of the Wifi module,
the IP address obtained, and other network details.
If you use 40-bit WEP, you need a key that is 10 characters long,
and the characters must be hexadecimal (0-9 or A-F).
e.g. for 40-bit, ABBADEAF01 will work, but ABBADEAF won't work
(too short) and ABBAISDEAF won't work (I and S are not
@arduitronics
arduitronics / unowifipms.ino
Last active October 25, 2019 16:10
ตัวอย่างการเชื่อมต่อค่าที่อ่านได้จาก PMS Sesor เพื่อวัดค่า PM 2.5 แล้วส่งค่าไปที่ thingspeak.com บทความ: https://www.arduitronics.com/article/70/
#include <SoftwareSerial.h>
#include "ThingSpeak.h"
#include <WiFiNINA.h>
SoftwareSerial pmsSerial(2, 3);
// Use this file to store all of the private credentials
// and connection details
//#define SECRET_SSID "HUAWEI Mate 9" // replace MySSID with your WiFi network name
//#define SECRET_PASS "g4265184" // replace MyPassword with your WiFi password
#include <PZEM004Tv30.h>
PZEM004Tv30 pzem(11, 12);
void setup() {
Serial.begin(115200);
}
void loop() {
float voltage = pzem.voltage();
if(voltage != NAN){
Serial.print(“Voltage: “); Serial.print(voltage); Serial.println(“V”);
}
#include "ESP8266WiFi.h"
#include "HTTPSRedirect.h"
#include "DebugMacros.h"
#include <PZEM004Tv30.h>
String sheetVolt = "";
String sheetCurrent = "";
String sheetPower = "";
String sheetEnergy = "";
String sheetFrequency = "";
// Created by Sujay S. Phadke, 2017
// All Rights Reserved.
// Github: https://github.com/electronicsguy
//
// Read/Write to Google Sheets using REST API.
// Can be used with ESP8266 & other embedded IoT devices.
//
// Use this file with the ESP8266 library HTTPSRedirect
//
// doGet() and doPost() need the spreadsheet ID. Cannot use "active spreadsheet" here since
/********************************************************************************
* ADXL345 Library Examples- pitch_roll.ino *
* *
* Copyright (C) 2012 Anil Motilal Mahtani Mirchandani(anil.mmm@gmail.com) *
* *
* License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> *
* This is free software: you are free to change and redistribute it. *
* There is NO WARRANTY, to the extent permitted by law. *
* *
*********************************************************************************/
/*
LiquidCrystal Library - "Hello !!!! Arduitronics"
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello !!!! Arduitronics" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 8
//Sample using LiquidCrystal library
#include <LiquidCrystal.h>
/*******************************************************
This program will test the LCD panel and the buttons
Mark Bramwell, July 2010
********************************************************/
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define some values used by the panel and buttons
int lcd_key = 0;