Events Building Block
Scratch 和 Micro: bit 的基本編程 Building Block 也很相似。接下來會向大家介紹 Scratch 3.0 內 專屬 BT Smart Controller 的 Building Block。
Events:
即是 Condition, 用作 激發 Program 運作。
在 Scratch 3.0 中, 有兩個屬於 BT Smart Controller 的 Events。 兩個 Events的最大分別是以 Digital Sensor(即數值只有 1 和 0) 或 Analog Sensor (即有數值的變化)來引發Program。
以下是 以 Digital Sensor 作為 Events 的例子。
中間 Button 可以改變成為其他 Digital Sensor,例如:Light Barrier
數字 1 則表示是 input 的 pin 1。 BT Smart Controller 有 4 個 input pin1, pin2, pin 3, pin4。
Closes and Opens 代表 數值上的 1 和 0。
If Button 1 closes
即是 如果在 Pin 1 的 Button 關閉的時候,


以下是 以 Analog Sensor 作為 Events 的例子。
中間 Color Sensor 可以改變成為其他 Analog Sensor,例如 Photo Resistor
數字 1 則表示是 input 的 pin 1。 BT Smart Controller 有 4 個 input pin1, pin2, pin 3, pin4。
> 則是數學上的大於,亦可改成 < 少於。
而 100 則是自設的數值。
由於Analog Sensor 的數值 可以多於 1和0的變化,所以便可以用這個 Analog Events。
If value of Color sensor 1 > 100
即是 如果 在 Pin 1 的 Color Sensor 數值大·於 100 的時候,

影片介紹