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
/* | |
Requirement NODEJS | |
- facebook-chat-api | |
- microgear | |
*/ | |
/* ### START CONFIG ### */ | |
var facebookEmail = 'email'; | |
var facebookPassword = 'pass'; | |
//NETPIe |
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 = 9; // ประกาศ pin สำหรับการใช้ PWM | |
int brightness = 0; // ตัวแปรปรับความสว่าง (0-255) | |
void setup() { | |
pinMode(led, OUTPUT); //กำหนดให้ pin led เป็นขาส่งสัญญาณออก | |
} | |
void loop() { | |
analogWrite(led, brightness); //คำสั่งให้ led แสดงผล | |
} |
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() { | |
pinMode(13, OUTPUT); | |
/*ฟังก์ชั่น pinMode(13,OUTPUT); คือการกำหนดโหมดของการทำงานของขานั้นๆ เช่นคำสั่งนี้จะทำให้ขา 13 มีสถานะคือการ output นั้นคือสามารถกำหนดให้มีไฟออกจากไมโครคอนโทรเลอร์ได้ว่าจะให้ออก 0V หรือ 5V ตาม logic ที่เรากำหนดในโปรแกรม หรือพูดให้เข้าใจง่ายๆ คือ สั่งหรือติดหรือดับนั้นเอง*/ | |
} | |
void loop() { |
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 pushButton = 2; | |
/*เป็นการประกาศตัวแปรชนิด int (เก็บจำนวนเต็ม) ชื่อว่า pushButton โดยมีค่าเท่ากับ 2 เพื่อเก็บค่านี้ไว้ใช้ต่อในส่วนต่อไปของโปรแกรม*/ | |
void setup() { | |
Serial.begin(9600); | |
/*ฟังก์ชั่น Serial.begin(9600); เป็นการเรียกใช้งาน Serial Communication ผ่านการเชื่อมต่อ Serial Port (ในที่นี้ Arduino จะใช้การเชื่อมต่อผ่าน USB โดยมี USB to Serial ภายใน) ด้วยความเร็วที่เชื่อมต่อคือ 9600 หรือเรียกว่าบรอทเรต 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
void setup() { | |
Serial.begin(9600); | |
/*ฟังก์ชั่น Serial.begin(9600); เป็นการเรียกใช้งาน Serial Communication ผ่านการเชื่อมต่อ Serial Port (ในที่นี้ Arduino จะใช้การเชื่อมต่อผ่าน USB โดยมี USB to Serial ภายใน) ด้วยความเร็วที่เชื่อมต่อคือ 9600 หรือเรียกว่าบรอทเรต 9600*/ | |
} | |
void loop() { |
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 ledState = LOW; | |
/* กำหนดตัวแปร ledState สำหรับเก็บสถานะเริ่มต้นของ led */ | |
unsigned long previousMillis = 0; | |
/* กำหนดตัวแปน previousMillis สำหรับเก็บข้อมูลเวลาก่อนหน้า */ | |
long interval = 1000; | |
/* กำหนดตัวแปร interval เพื่อใช้ในการปรับเปลี่ยนเวลาในการเปลียน ledState */ | |
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 <AntoIO.h> | |
AntoIO anto("JackRoboticS", "p7erLWvOQsdRAwVylmdF8eR0OX1VMNSHfk1GRzCX", "TIME"); | |
int day,month,year,hours,minutes,seconds; | |
bool bIsConnected = false; | |
void setup() { | |
// SSID and Password of your WiFi access point. | |
const char* ssid = "HONEYLab"; |
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
var fs = require('fs'); | |
// function to create file from base64 encoded string | |
function base64_decode(base64str, file) { | |
// create buffer object from base64 encoded string, it is important to tell the constructor that the string is base64 encoded | |
var bitmap = new Buffer(base64str, 'base64'); | |
// write buffer to file | |
fs.writeFileSync(file, bitmap); | |
} |
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
private void lineNotify(string msg) | |
{ | |
string token = "9IBnp37LVHj0a6W5HLq2dF7sqIjGyEVn2DQtpQq7wYv"; | |
try | |
{ | |
var request = (HttpWebRequest)WebRequest.Create("https://notify-api.line.me/api/notify"); | |
var postData = string.Format("message={0}", msg); | |
var data = Encoding.UTF8.GetBytes(postData); | |
request.Method = "POST"; |
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
#!/usr/local/bin/python | |
# -*- coding: utf-8 -*- | |
import requests | |
url = 'https://notify-api.line.me/api/notify' | |
token = '9IBnp37LVHj0a6W5HLq2dF7sqIjGyEVn2DQtpQq7wYv' | |
headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer '+token} | |
msg = 'ทดสอบภาษาไทย hello' |
OlderNewer