本文件涵蓋了Grove系統的功能,包括數位和類比端口操作、伺服器和馬達控制、感測器數據讀取、四位數顯示管理,以及播放聲音等附加功能。
數位
獲取埠結果
數位讀取埠
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>photo</variable><variable>faceDetectionResult</variable></variables><block type=\"Grove_digitalRead\" disabled=\"true\" x=\"158\" y=\"293\"><field name=\"port\">GroveDigitalPort.D5</field></block></xml>"}
這用於從特定埠獲取值。
參數: N/A
條件: D5(預設)/D16/D18/D22/D26
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"Grove_digitalRead\"><field name=\"port\">GroveDigitalPort.D5</field></block></value></block></statement></block></xml>"}
輸出:

修改埠值
數位寫入埠到
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"Grove_digitalWrite\" disabled=\"true\" x=\"23\" y=\"202\"><field name=\"port\">GroveDigitalPort.D5</field><value name=\"signal\"><shadow type=\"math_number\" disabled=\"true\"><field name=\"NUM\">0</field></shadow></value></block></xml>"}
這用於修改埠值。
參數: N/A
條件: D5(預設)/D16/D18/D22/D26
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"Grove_digitalWrite\"><field name=\"port\">GroveDigitalPort.D5</field><value name=\"signal\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow></value></block></statement></block></xml>"}
輸出:


類比
讀取電流電壓
模擬讀取埠輸入電壓
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"Grove_analogReadVoltage\" disabled=\"true\" x=\"-22\" y=\"337\"><field name=\"port\">GroveAnalogPort.A0</field></block></xml>"}
這用於讀取硬體的當前電壓。
參數: N/A
條件: A0(預設)/A2/A4/A6
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"Grove_analogReadVoltage\"><field name=\"port\">GroveAnalogPort.A0</field></block></value></block></statement></block></xml>"}
輸出:

讀取當前原始數據
模擬讀取埠原始數據
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"Grove_analogReadRaw\" disabled=\"true\" x=\"113\" y=\"337\"><field name=\"port\">GroveAnalogPort.A0</field></block></xml>"}
這用於讀取硬體的當前數據。
參數: N/A
條件: A0(預設)/A2/A4/A6
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"Grove_analogReadRaw\"><field name=\"port\">GroveAnalogPort.A0</field></block></value></block></statement></block></xml>"}
輸出:

掃描硬體的當前值
類比讀取埠
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"Grove_analogRead\" disabled=\"true\" x=\"113\" y=\"292\"><field name=\"port\">GroveAnalogPort.A0</field></block></xml>"}
這用於讀取連結到相應埠的硬體的當前值。
參數: N/A
條件: A0(預設)/A2/A4/A6
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"Grove_analogRead\"><field name=\"port\">GroveAnalogPort.A0</field></block></value></block></statement></block></xml>"}
輸出:

伺服
更改電機方向
伺服寫入埠到度
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"Grove_servoDegreeSet\" disabled=\"true\" x=\"23\" y=\"607\"><field name=\"port\">GrovePWMPort.PWM</field><value name=\"degree\"><shadow type=\"math_number_minmax\" disabled=\"true\"><mutation min=\"0\" max=\"180\" label=\"Degree\" precision=\"0\"/><field name=\"SLIDER\">90</field></shadow></value></block></xml>"}
這用於改變電機的角度。
參數: N/A
條件:
- PWM(預設)/D5/D16/D18/D22/D26
- 數量(預設:90)
輸出: 電機
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"Grove_servoDegreeSet\"><field name=\"port\">GrovePWMPort.PWM</field><value name=\"degree\"><shadow type=\"math_number_minmax\"><mutation min=\"0\" max=\"180\" label=\"Number\" precision=\"0\"/><field name=\"SLIDER\">90</field></shadow></value></block></statement></block></xml>"}
輸出:



感測器
獲取感測器的手勢值
手勢感測器:獲取手勢值
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>GestureSens
初始化手勢值
啟動手勢感測器
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>GestureSensor</variable></variables><block type=\"Grove_initGestureSensor\" disabled=\"true\" x=\"-22\" y=\"202\"/></xml>"}
讀取當前光值
光感測器讀取埠
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>GestureSensor</variable></variables><block type=\"Grove_groveLightSensorRead\" disabled=\"true\" x=\"-22\" y=\"247\"><field name=\"channel\">GroveAnalogPort.A0</field></block></xml>"}
這用於從光感測器讀取當前的光值。
參數: N/A
條件: A0(預設)/A2/A4/A6
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"Grove_groveLightSensorRead\"><field name=\"channel\">GroveAnalogPort.A0</field></block></value></block></statement></block></xml>"}
輸出:

讀取旋轉角度感測器的電流值
旋轉角度感測器讀取埠
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"Grove_rotaryAngleSensorRead\" disabled=\"true\" x=\"112\" y=\"292\"><field name=\"channel\">GroveAnalogPort.A0</field></block></xml>"}
這用於從旋轉角度感測器讀取電流值。
參數: N/A
條件: A0(預設)/A2/A4/A6
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>index</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"pxt_controls_for\"><value name=\"VAR\"><shadow type=\"variables_get_reporter\"><field name=\"VAR\">index</field></shadow></value><value name=\"TO\"><shadow type=\"math_whole_number\"><field name=\"NUM\">10</field></shadow></value><statement name=\"DO\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"Grove_rotaryAngleSensorRead\"><field name=\"channel\">GroveAnalogPort.A0</field></block></value><next><block type=\"basic_sleep\"><value name=\"ms\"><shadow type=\"math_number\"><field name=\"NUM\">1000</field></shadow></value></block></next></block></statement></block></statement></block></xml>"}
輸出:


掃描超聲波Ranger讀取感測器的電流值
超聲波測距儀讀取(cm)埠
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>index</variable></variables><block type=\"Grove_ultrasonicReadCm\" disabled=\"true\" x=\"22\" y=\"338\"><field name=\"port\">GroveDigitalPort.D5</field></block></xml>"}
這用於從超聲波測距器讀取感測器讀取電流值。
參數: N/A
條件: A0(預設)/A2/A4/A6
輸出: 數位
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>index</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"pxt_controls_for\"><value name=\"VAR\"><shadow type=\"variables_get_reporter\"><field name=\"VAR\">index</field></shadow></value><value name=\"TO\"><shadow type=\"math_whole_number\"><field name=\"NUM\">10</field></shadow></value><statement name=\"DO\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"Grove_ultrasonicReadCm\"><field name=\"port\">GroveDigitalPort.D5</field></block></value><next><block type=\"basic_sleep\"><value name=\"ms\"><shadow type=\"math_number\"><field name=\"NUM\">1000</field></shadow></value></block></next></block></statement></block></statement></block></xml>"}
輸出:



電機驅動器
設置電機驅動器的位址
使用位址開關 1 2 3 4 建立馬達驅動器
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>index</variable></variables><block type=\"Grove_createMotorDriver\" disabled=\"true\" x=\"-22\" y=\"428\"><field name=\"s1\">Switch.ON</field><field name=\"s2\">Switch.ON</field><field name=\"s3\">Switch.ON</field><field name=\"s4\">Switch.ON</field></block></xml>"}
這用於為電機驅動器設置正確的位址。
參數: N/A
條件: 開(預設)/關
輸出: N/A
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>MotorDriver</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">MotorDriver</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createMotorDriver\"><field name=\"s1\">Switch.ON</field><field name=\"s2\">Switch.ON</field><field name=\"s3\">Switch.ON</field><field name=\"s4\">Switch.ON</field></block></value><next><block type=\"Grove_MotorDriver_setMotorOffset\"><field name=\"motor\">GroveMotorDriverConstant.M1</field><value name=\"MotorDriver\"><block type=\"variables_get\"><field name=\"VAR\">MotorDriver</field></block></value><value name=\"speed\"><shadow type=\"math_number_minmax\"><mutation min=\"0\" max=\"100\" label=\"Number\" precision=\"0\"/><field name=\"SLIDER\">100</field></shadow></value></block></next></block></statement></block></xml>"}
輸出:


設置電機驅動器速度
電機驅動器:將電機 M1 設置為速度
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>MotorDriver</variable></variables><block type=\"Grove_MotorDriver_setMotorOffset\" disabled=\"true\" x=\"23\" y=\"383\"><field name=\"motor\">GroveMotorDriverConstant.M1</field><value name=\"MotorDriver\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">MotorDriver</field></block></value><value name=\"speed\"><shadow type=\"math_number_minmax\" disabled=\"true\"><mutation min=\"0\" max=\"100\" label=\"Offset\" precision=\"0\"/><field name=\"SLIDER\">0</field></shadow></value></block></xml>"}
這用於設置馬達驅動器速度,使馬達驅動器移動。
參數:電機驅動器
條件:
- M1(預設)/M2
- 數字(預設值:0)
輸出: N/A
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>MotorDriver</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">MotorDriver</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createMotorDriver\"><field name=\"s1\">Switch.ON</field><field name=\"s2\">Switch.ON</field><field name=\"s3\">Switch.ON</field><field name=\"s4\">Switch.ON</field></block></value><next><block type=\"Grove_MotorDriver_setMotorOffset\"><field name=\"motor\">GroveMotorDriverConstant.M1</field><value name=\"MotorDriver\"><block type=\"variables_get\"><field name=\"VAR\">MotorDriver</field></block></value><value name=\"speed\"><shadow type=\"math_number_minmax\"><mutation min=\"0\" max=\"100\" label=\"Number\" precision=\"0\"/><field name=\"SLIDER\">100</field></shadow></value></block></next></block></statement></block></xml>"}
輸出:


四位數字顯示
設置四位數字顯示的位置
創建帶埠的四位數顯示器
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>MotorDriver</variable></variables><block type=\"Grove_createFourDigitDisplay\" disabled=\"true\" x=\"157\" y=\"472\"><field name=\"port\">GroveDigitalPort.D5</field></block></xml>"}
這用於將四位數字顯示在正確的位置。
參數: N/A
條件: D5(預設)/D16/D18/D22/D26
輸出: N/A
示例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">FourDigitDisplay</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createFourDigitDisplay\"><field name=\"port\">GroveDigitalPort.D5</field></block></value><next><block type=\"Grove_FourDigitDisplay_setColon\"><field name=\"status\">Switch.ON</field><value name=\"FourDigitDisplay\"><block type=\"variables_get\"><field name=\"VAR\">FourDigitDisplay</field></block></value></block></next></block></statement></block></xml>"}
輸出:


設置四位數字顯示的冒號燈
四位數字顯示:設置冒號
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"Grove_FourDigitDisplay_setColon\" disabled=\"true\" x=\"23\" y=\"247\"><field name=\"status\">Switch.ON</field><value name=\"FourDigitDisplay\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">FourDigitDisplay</field></block></value></block></xml>"}
這用於將四位顯示冒號燈設置為打開或關閉。
參數: 四位數字顯示
條件: 開(預設)/關
輸出: 四位數字顯示
範例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">FourDigitDisplay</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createFourDigitDisplay\"><field name=\"port\">GroveDigitalPort.D5</field></block></value><next><block type=\"Grove_FourDigitDisplay_setColon\"><field name=\"status\">Switch.ON</field><value name=\"FourDigitDisplay\"><block type=\"variables_get\"><field name=\"VAR\">FourDigitDisplay</field></block></value></block></next></block></statement></block></xml>"}
輸出:


設置四位顯示器的亮度
四位數字顯示:設置冒號
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"Grove_FourDigitDisplay_setBrightness\" disabled=\"true\" x=\"23\" y=\"247\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">FourDigitDisplay</field></block></value><value name=\"brightness\"><shadow type=\"math_number_minmax\" disabled=\"true\"><mutation min=\"0\" max=\"7\" label=\"Brightness\" precision=\"0\"/><field name=\"SLIDER\">2</field></shadow></value></block></xml>"}
這用於設置四位數顯示器的燈光亮度。
參數: 四位數字顯示
條件: 數字(預設值:2)
輸出: 四位數字顯示
範例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">FourDigitDisplay</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createFourDigitDisplay\"><field name=\"port\">GroveDigitalPort.D5</field></block></value><next><block type=\"Grove_FourDigitDisplay_setBrightness\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\"><field name=\"VAR\">FourDigitDisplay</field></block></value><value name=\"brightness\"><shadow type=\"math_number_minmax\"><mutation min=\"0\" max=\"7\" label=\"Number\" precision=\"0\"/><field name=\"SLIDER\">7</field></shadow></value><next><block type=\"Grove_FourDigitDisplay_showNumber\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\"><field name=\"VAR\">FourDigitDisplay</field></block></value><value name=\"num\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow></value></block></next></block></next></block></statement></block></xml>"}
輸出:


顯示四位數字顯示的數量
四位數字顯示 : 顯示編號
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"Grove_FourDigitDisplay_showNumber\" disabled=\"true\" x=\"23\" y=\"473\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">FourDigitDisplay</field></block></value><value name=\"num\"><shadow type=\"math_number\" disabled=\"true\"><field name=\"NUM\">0</field></shadow></value></block></xml>"}
這用於顯示四位數字顯示的數值。
參數: 四位數字顯示
條件:數字(預設值:0)
輸出: 四位數字顯示(數位)
範例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">FourDigitDisplay</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createFourDigitDisplay\"><field name=\"port\">GroveDigitalPort.D5</field></block></value><next><block type=\"Grove_FourDigitDisplay_showNumber\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\"><field name=\"VAR\">FourDigitDisplay</field></block></value><value name=\"num\"><shadow type=\"math_number\"><field name=\"NUM\">88</field></shadow></value></block></next></block></statement></block></xml>"}
輸出:


顯示四位數字顯示的文字
四位數字顯示 : 顯示文字
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"Grove_FourDigitDisplay_showText\" disabled=\"true\" x=\"23\" y=\"472\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">FourDigitDisplay</field></block></value><value name=\"txt\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\"/></shadow></value></block></xml>"}
這用於顯示四位數顯示的文字。
參數: 四位數字顯示
條件: 發簡訊
輸出: 四位數字顯示(文字)
範例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">FourDigitDisplay</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createFourDigitDisplay\"><field name=\"port\">GroveDigitalPort.D5</field></block></value><next><block type=\"Grove_FourDigitDisplay_showText\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\"><field name=\"VAR\">FourDigitDisplay</field></block></value><value name=\"txt\"><shadow type=\"text\"><field name=\"TEXT\">HI</field></shadow></value></block></next></block></statement></block></xml>"}
輸出:


清除四位數字顯示的值
四位數字顯示:清晰
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"Grove_FourDigitDisplay_clear\" disabled=\"true\" x=\"23\" y=\"562\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">FourDigitDisplay</field></block></value></block></xml>"}
這用於刪除在四位數字顯示中顯示的值。
參數: 四位數字顯示
輸出: 四位數字顯示
範例代碼:
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">FourDigitDisplay</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Grove_createFourDigitDisplay\"><field name=\"port\">GroveDigitalPort.D5</field></block></value><next><block type=\"Grove_FourDigitDisplay_clear\"><value name=\"FourDigitDisplay\"><block type=\"variables_get\"><field name=\"VAR\">FourDigitDisplay</field></block></value></block></next></block></statement></block></xml>"}
輸出:


其他
播放聲音
揚聲器埠節拍的播放音
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>FourDigitDisplay</variable></variables><block type=\"Grove_speaker\" disabled=\"true\" x=\"23\" y=\"697\"><field name=\"port\">GroveDigitalPort.D5</field><field name=\"tone\">SpeakerTone.LC</field><field name=\"beat\">BeatFraction.Whole</field></block></xml>"}
這用於在揚聲器中播放不同的聲音。
參數: N/A
條件:
- D5 (預設)/D16/D18/D22/D26
- Low_C(預設)/Low_D/Low_E/Low_F/Low_G/Low_A/Low_B/Middle_C/Middle_D/Middle_E/Middle_F/Middle_G/Middle_A/Middle_B/High_C/High_D/High_E/High_F/High_G/High_A/High_B
- 1 (預設) / 1/2 / 1/4 / 1/8 / 1/16 / 2 / 4
輸出:喇叭
{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"Grove_speaker\"><field name=\"port\">GroveDigitalPort.D5</field><field name=\"tone\">SpeakerTone.LC</field><field name=\"beat\">BeatFraction.Whole</field></block></statement></block></xml>"}
輸出:

目録