google-sheet2Html

/*! * * Google Sheets To HTML v0.9a * * To use, simply replace the "tq?key=" value in the * URL below with your own unique Google document ID * * The Google document's sharing must be set to public * */ google.load('visualization', '1', { packages: ['table'] }); var visualization; function drawVisualization() { var query = new google.visualization.Query('https://spreadsheets.google.com/tq?key=https://docs.google.com/spreadsheets/d/1-vUEZ9tae5C_OXzSi0dQPWwUrO3H5S-gImB5afFgqDg/edit?usp=sharing'); query.setQuery('SELECT A, B, C, D label A "Duration", B "Song", C "Requested By", D "URL"'); query.send(handleQueryResponse); } function handleQueryResponse(response) { if (response.isError()) { alert('There was a problem with your query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } var data = response.getDataTable(); visualization = new google.visualization.Table(document.getElementById('table')); visualization.draw(data, { legend: 'bottom' }); } google.setOnLoadCallback(drawVisualization);

Monday, August 7, 2017

ควบคุม Arduino ด้วย Processing


ใช้Processing ควบคุมบอร์ดArduino ด้วย Firmata

 



ในกรณีทีต้องการ ควบคุม Arduino ผ่านโปรแกรม Processing ทำได้โดย การ upload firmware ชื่อ Firmata ลงไปบนบอร์ด Arduino 


การติดตั้ง Firmata ลงบน Processing ให้ทำการ download เวอร์ชั่นล่าสุดจาก http://playground.arduino.cc/Interfacing/Processing

โดยเลือกให้ตรงกับเวอร์ชั่น ของ Processing ที่ติดตั้งไว้ ในที่นี้ เป็นตัวอย่างสำหรับ Processing v3 



เลือกดาว์โหลด processing-arduino.zip


 



ทำการแตกไฟล์ จะได้ โฟลเดอร์ arduino ทำการcopy ไปยัง sketchbook ซับโฟลเดอร์ libraries


 
 


เปิดโปรแกรม Arduino เลือก file → Examples → Firmata → StandardFirmata จากนั้นทำการ อัพโหลด ลงบอร์ด 






ในโค้ดตัวอย่างให้เปลี่ยน ค่าระบุชื่อพอร์ทที่ติดตั้งบอร์ด จาก [0] เป็น ttyACM0 (ปรกติจะเป็น ชื่อแรกที่ list ออกมาทาง ด้านล่่าง
 

ตัวอย่างเช่น โค้ดเดิม

arduino = new Arduino(this, Arduino.list()[0], 57600);

ให้แก้ไข เป็น

arduino = new Arduino(this, "/dev/ttyACM0", 57600);