Skip to content

Instantly share code, notes, and snippets.

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

MisterNay misternay

🏠
Working from home
View GitHub Profile
void setup() {
Serial.begin(9600);
}
void loop() {
delay(500);
Serial.println("HElloWorld");
}
@misternay
misternay / serialport.cs
Last active October 23, 2017 09:52
serial Arduino
String[] ports = SerialPort.GetPortNames();;//เก็บพอร์ตที่เชื่อมต่อนะครับ
SerialPort port = new SerialPort("COM4", 9600, Parity.None, 8, StopBits.One);
port.DataReceived += port_Data;
port.Open();
port.ReadLine();
using System;
using System.IO.Ports;
namespace ConsoleApplication2
{
class Program
{
//public static string[] ports;
public static SerialPort port;
static void Main(string[] args)
{
String name = "";
void setup() {
Serial.begin(9600);
}
void loop() {
getText();
if (name != "") {
Serial.println("HEllo: " + name);
name = "";
}
using System;
using System.IO.Ports;
namespace ConsoleApplication2
{
class Program
{
//public static string[] ports;
public static SerialPort port;
static void Main(string[] args)
{
@misternay
misternay / blynkTest.ino
Created October 29, 2017 11:39
BlynkLCD+BUTTON on Virtual PIN
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "--Token--";//นำโทเค็นในแอพมาใส่
char ssid[] = "--SSID--";//ชื้่อไวไฟ
char pass[] = "--PASSWORDWIFI--";//พาสเวิด
WidgetLCD lcd(V0);//เรียกใช้LCDโดยV0==VIRTURLPIN ที่เลือกไว้นะครับ
void setup()
String setJsonString(int counts) {
String jsonS = "{\n";
jsonS += "\"homeMobileCountryCode\": 234,\n"; // this is a real UK MCC
jsonS += "\"homeMobileNetworkCode\": 27,\n"; // and a real UK MNC
jsonS += "\"radioType\": \"gsm\",\n"; // for gsm
jsonS += "\"carrier\": \"Vodafone\",\n"; // associated with Vodafone
jsonS += "\"wifiAccessPoints\": [\n";
for (int j = 0; j < counts; ++j)
{
jsonS += "{\n";
void callRestAPI(String jsonString, String host, String url, String key) {
WiFiClientSecure client;
DynamicJsonBuffer jsonBuffer;
Serial.print("Requesting URL: ");
Serial.println(" ");
if (client.connect(Host, 443)) { //443
Serial.println("Connected");
client.println("POST " + url + key + " HTTP/1.1");
client.println("Host: " + (String)Host);
client.println("Connection: close");
#include "ESP8266WiFi.h"
#include <ArduinoJson.h>
const char* Host = "www.googleapis.com";
String thisPage = "/geolocation/v1/geolocate?key=";
String key = "AIzaSyDeUxorNncriqxB3c2jVz0GrLfqpFG1A4c";
double latitude = 0.0;
double longitude = 0.0;
double accuracy = 30.0;
int check = 0;