記錄light sensor的value並上傳至google sheet
如何連接Google sheet ?

選取「Sheet」

選取「ADD SHEET」

選擇並登入你的google 帳戶

3個選項都能連接google sheet , 可看自己的需要來選擇
這次我們選擇「New Spreadsheet」

輸入Spreadsheet的名字並Submit

完成後,你會在左方的「CONNECTED DEVICES」中看到如上圖一樣的設定。
按下sam labs light 的連結會自動在新分頁打開你的google sheet。

按下後應該會是這個模樣
編程部份
首先請確保light sensor跟google sheet已經連接。

Coding 概覽 :

Coding 連結 : 按我
Coding 步驟
1. program start 時要將row 設成0 , 這樣google sheet 才能在A1和B1開始記錄數據

n 是1個variable , 我們要先create 1 個variable


然後把set n to 拉出來 , 再從Math中選出 0 把放到空框裡。


2. 設google sheet的部份 , 在sheet 的 Actions 選在 「in sheet append row with 」的那個block

首先設讀數名稱的部份

我們希望在google sheet 中讀取到的數據名字為「light lv」,
所以整個A colum 也會出現「light lv : 」來顯示該數據是什麼單位/名稱
colum 我們設成A , row 為 n 這樣「light lv :」 便會在A1,A2,A3,An...中顯示.
然後設定讀取light sensor value的部分

同樣地使用「append row with」,這次選擇把「get light sensor value」拉進去,
這樣便能連續無間段地取得light sensor 的vlaue ,
colum 我們設成B , row 為 n 這樣light sensor 的value 便會在B1,B2,B3,Bn...中顯示.
3. 設什麼時間記錄

當light sensor 的數字有改變時,便會記錄,
change n by 1 便能在sheet中不斷記錄新數據.
示範 :
按下「RUN」後, 每5秒記錄1次light sensor的value ,
得出的結果將會如下圖般呈現中google sheet「sam labs light」上.

影片示範 :