User Manual
Print

Set the Address of Motor Driver

Create Motor Driver with address switch 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>"}
				
			

This is used for setting the motor driver with the correct address.

Parameters: N/A

Condition: ON (Default)/OFF

Output: N/A
Sample code:

				
					{"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>"}
				
			

The output:

Motor Driver : set motor M1 with speed - Output 1
Motor Driver : set motor M1 with speed - Output 2