Skip to content

Instantly share code, notes, and snippets.

#!/usr/local/bin/python
# -*- coding: utf-8 -*-
def lineNotify(message):
payload = {'message':message}
return _lineNotify(payload)
def notifyFile(filename):
file = {'imageFile':open(filename,'rb')}
payload = {'message': 'test'}
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
[email protected]
mail.smtp.password=
#define dataPin 8
#define latchPin 9
#define clockPin 10
void setup() {
pinMode(dataPin,OUTPUT); //set output
pinMode(latchPin,OUTPUT); //set output
pinMode(clockPin,OUTPUT); //set output
}
void loop() {
#include "mbed.h"
Serial pc(SERIAL_TX, SERIAL_RX);
DigitalInOut DHT22(PA_10);
uint16_t humi,temp;
bool DHT22_READ() { // ตัวอย่างฟังก์ชั่นอ่านข้อมูล
uint8_t data [5]; // สร้างตัวแปรเพื่อเก็บ Data protocol
DigitalInOut DHT22(PA_10); // กำหนดขาใช้งานต่อ DHT22
uint16_t humi,temp; // ประกาศตัวแปร เพื่อเก็บข้อมูล humi และ temp
bool DHT22_READ() { // ตัวอย่างฟังก์ชั่นอ่านข้อมูล
uint8_t data [5]; // สร้างตัวแปรเพื่อเก็บ Data protocol
DHT22.output(); // กำหนดให้ GPIO นั้นเป็น output
DHT22.write(0); // สั่งให้ GPIO ส่ง logic low
wait_ms(18); // รอ 18ms
#!/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'
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";
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);
}
@jackrobotics
jackrobotics / antoTime.ino
Created August 7, 2016 08:29
antoTime.ino
#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";
int ledState = LOW;
/* กำหนดตัวแปร ledState สำหรับเก็บสถานะเริ่มต้นของ led */
unsigned long previousMillis = 0;
/* กำหนดตัวแปน previousMillis สำหรับเก็บข้อมูลเวลาก่อนหน้า */
long interval = 1000;
/* กำหนดตัวแปร interval เพื่อใช้ในการปรับเปลี่ยนเวลาในการเปลียน ledState */
void setup() {