{
    "ok": true,
    "data": {
        "title": "EP-0108",
        "rev_id": 10668,
        "updated_at": "2021-08-27T10:25:27+00:00",
        "chunk_count": 38,
        "chunks": [
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "",
                "chunk_index": 0,
                "content": "# EP-0108",
                "char_count": 9,
                "token_estimate": 3
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Description",
                "chunk_index": 1,
                "content": "<img src=\"DockerPi_Motor_Board(A)-6.jpg\" title=\"DockerPi_Motor_Board(A)-6.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-6.jpg\" \/> DockerPi Motor Board(A) is a DockerPi series expansion board.It can control two 12V DC motors. It can be used in Raspberry Pi.You could communicate with it by opening I2C. it also can be stacked with other DockerPi expansion board. DockerPi Motor Board(A) has dozens of modes.You can develop it as you like. You could choose single motor,of course,you could control both of them at the same time. If you need to run for a long time ,we recommend that you use our DockerPi Power expansion board to provide more power.\n\n**Note: DockerPi Motor Board does not support hot plug.**",
                "char_count": 705,
                "token_estimate": 177
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Features",
                "chunk_index": 2,
                "content": "<figure>\n<img src=\"DockerPi_Motor_Board(A)-1.jpg\" title=\"DockerPi_Motor_Board(A)-1.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-1.jpg\" \/>\n<figcaption aria-hidden=\"true\">DockerPi_Motor_Board(A)-1.jpg<\/figcaption>\n<\/figure>\n\n-   DockerPi Series\n-   Programmable\n-   Control directly(without programming)\n-   Extend GPIO Pins\n-   Two DC 12V motors\n-   Selective control\n-   Can stack with other stack board\n-   Independent of the mainboard hardware (require I2C support)",
                "char_count": 468,
                "token_estimate": 117
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Official Compatibility Test",
                "chunk_index": 3,
                "content": "Not only support the following development boards, other development boards can be compatible if they have I2C peripherals. (Note: some software changes may be required)\n\n| Platform                  | DockerPi Motor Board | Notes                                |\n|---------------------------|----------------------|--------------------------------------|\n| Raspberry Pi All Platform | √                    | Not Include CM Series & EOL Platform |\n|                           |                      |                                      |",
                "char_count": 538,
                "token_estimate": 135
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Motor Board Details",
                "chunk_index": 4,
                "content": "<img src=\"DockerPi_Motor_Board(A)-10.jpg\" title=\"DockerPi_Motor_Board(A)-10.jpg\" width=\"400\" alt=\"DockerPi_Motor_Board(A)-10.jpg\" \/>",
                "char_count": 132,
                "token_estimate": 33
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Gallery",
                "chunk_index": 5,
                "content": "|                                                                                                                                   |                                                                                                                                   |                                                                                                                                   |\n|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| <figure>\n <img src=\"DockerPi_Motor_Board(A)-8.jpg\" title=\"DockerPi_Motor_Board(A)-8.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-8.jpg\" \/>\n <figcaption aria-hidden=\"true\">DockerPi_Motor_Board(A)-8.jpg<\/figcaption>\n <\/figure>                                                                                                                          | <figure>",
                "char_count": 1155,
                "token_estimate": 289
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Gallery",
                "chunk_index": 6,
                "content": "<img src=\"DockerPi_Motor_Board(A)-2.jpg\" title=\"DockerPi_Motor_Board(A)-2.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-2.jpg\" \/>\n                                                                                                                                     <figcaption aria-hidden=\"true\">DockerPi_Motor_Board(A)-2.jpg<\/figcaption>\n                                                                                                                                     <\/figure>                                                                                                                          | <figure>\n                                                                                                                                                                                                                                                                         <img src=\"DockerPi_Motor_Board(A)-3.jpg\" title=\"DockerPi_Motor_Board(A)-3.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-3.jpg\" \/>",
                "char_count": 1006,
                "token_estimate": 252
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Gallery",
                "chunk_index": 7,
                "content": "<figcaption aria-hidden=\"true\">DockerPi_Motor_Board(A)-3.jpg<\/figcaption>\n                                                                                                                                                                                                                                                                         <\/figure>                                                                                                                          |",
                "char_count": 471,
                "token_estimate": 118
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Gallery",
                "chunk_index": 8,
                "content": "|                                                                                                                                   |                                                                                                                                   |                                                                                                                                   |\n|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| <figure>\n <img src=\"DockerPi_Motor_Board(A)-7.jpg\" title=\"DockerPi_Motor_Board(A)-7.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-7.jpg\" \/>\n <figcaption aria-hidden=\"true\">DockerPi_Motor_Board(A)-7.jpg<\/figcaption>\n <\/figure>                                                                                                                          | <figure>",
                "char_count": 1155,
                "token_estimate": 289
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Gallery",
                "chunk_index": 9,
                "content": "<img src=\"DockerPi_Motor_Board(A)-5.jpg\" title=\"DockerPi_Motor_Board(A)-5.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-5.jpg\" \/>\n                                                                                                                                     <figcaption aria-hidden=\"true\">DockerPi_Motor_Board(A)-5.jpg<\/figcaption>\n                                                                                                                                     <\/figure>                                                                                                                          | <figure>\n                                                                                                                                                                                                                                                                         <img src=\"DockerPi_Motor_Board(A)-4.jpg\" title=\"DockerPi_Motor_Board(A)-4.jpg\" width=\"300\" alt=\"DockerPi_Motor_Board(A)-4.jpg\" \/>",
                "char_count": 1006,
                "token_estimate": 252
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Gallery",
                "chunk_index": 10,
                "content": "<figcaption aria-hidden=\"true\">DockerPi_Motor_Board(A)-4.jpg<\/figcaption>\n                                                                                                                                                                                                                                                                         <\/figure>                                                                                                                          |",
                "char_count": 471,
                "token_estimate": 118
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Package Includes",
                "chunk_index": 11,
                "content": "-   1 x Motor Board\n-   2 x DC Motor\n-   2 x PH Connector\n-   1 x Instruction\n-   4 x M2.5\\*12 + 6 Copper stick\n-   4 x M2.5\\*6 Nut\n-   4 x M2.5\\*6 Half-round head screw\n\n[left\\|250px ](File:DockerPi_Motor_Board(A)-9.jpg \"wikilink\")",
                "char_count": 232,
                "token_estimate": 58
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Register Map",
                "chunk_index": 12,
                "content": "| Register Address | Function                             | Value                                                      |\n|------------------|--------------------------------------|------------------------------------------------------------|\n| 0x01             | Set Motor A Speed or Set Motor A PWM | Set Motor A Speed Low 8 bit or Set Motor A PWM Low 8 bit   |\n| 0x02             | Set Motor A Speed or Set Motor A PWM | Set Motor A Speed High 7 bit or Set Motor A PWM High 7 bit |\n| 0x03             | Set Motor B Speed or Set Motor B PWM | Set Motor B Speed Low 8 bit or Set Motor B PWM Low 8 bit   |\n| 0x04             | Set Motor B Speed or Set Motor B PWM | Set Motor B Speed High 7 bit or Set Motor B PWM High 7 bit |\n| 0x05             | Set Motor A Count                    | Set Motor A Count Low 8 bit                                |\n| 0x06             | Set Motor A Count                    | Set Motor A Count High 8 bit                               |\n| 0x07             | Set Motor B Count                    | Set Motor B Count Low 8 bit                                |",
                "char_count": 1088,
                "token_estimate": 272
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Register Map",
                "chunk_index": 13,
                "content": "| 0x08             | Set Motor B Count                    | Set Motor B Count High 8 bit                               |\n| 0x09             | Set status of Direction              | Set Motor A and Motor B's Direction                        |\n| 0x0A             | Now Motor A Speed                    | Now Motor A Speed Low 8 bit                                |\n| 0x0B             | Now Motor A Speed                    | Now Motor A Speed High 8 bit                               |\n| 0x0C             | Now Motor B Speed                    | Now Motor B Speed Low 8 bit                                |\n| 0x0D             | Now Motor B Speed                    | Now Motor B Speed High 8 bit                               |\n| 0x0E             | Now Motor A Count                    | Now Motor A Count Low 8 bit                                |\n| 0x0F             | Now Motor A Count                    | Now Motor A Count High 8 bit                               |\n| 0x10             | Now Motor B Count                    | Now Motor B Count Low 8 bit                                |",
                "char_count": 1088,
                "token_estimate": 272
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Register Map",
                "chunk_index": 14,
                "content": "| 0x11             | Now Motor B Count                    | Now Motor B Count High 8 bit                               |\n| 0x12             | Now status of Direction              | Current status of Direction                                |\n| 0x13             | Enable                               | Enable data write                                          |\n| 0x14             | Alignment                            | Set the way to align                                       |\n| 0x15             | Loop                                 | MotorA Circle Low 8 bit                                    |\n| 0x16             | Loop                                 | MotorA Circle range from 8 to 15 bit                       |\n| 0x17             | Loop                                 | MotorA Circle range from 16 to 23 bit                      |\n| 0x18             | Loop                                 | MotorA Circle High 8 bit                                   |\n| 0x19             | Loop                                 | MotorB Circle Low 8 bit                                    |",
                "char_count": 1088,
                "token_estimate": 272
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Register Map",
                "chunk_index": 15,
                "content": "| 0x1a             | Loop                                 | MotorB Circle ranges from 8 to 15 bit                      |\n| 0x1b             | Loop                                 | MotorB Circle ranges from 16 to 23 bit                     |\n| 0x1c             | Loop                                 | MotorB Circle High 8 bit                                   |\n| 0x1d             | PWM                                  | MotorA PWM Low 8 bit                                       |\n| 0x1e             | PWM                                  | MotorA PWM High 8 bit                                      |\n| 0x1f             | PWM                                  | MotorB PWM Low 8 bit                                       |\n| 0x20             | PWM                                  | MotorB PWM High 8 bit                                      |\n|                  |                                      |                                                            |",
                "char_count": 967,
                "token_estimate": 242
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Register Map",
                "chunk_index": 16,
                "content": "| STATUS_REG    | 0x02                  |\n|---------------|-----------------------|\n| Default Value | 0\/1                   |\n| Description   | PWM MODEL\/SPEED MODEL |\n| STATUS_REG    | 0x04                  |\n| Default Value | 0\/1                   |\n| Description   | PWM MODEL\/SPEED MODEL |\n| STATUS_REG    | 0x09                  |\n| Default Value | 0                     |\n| Description   | Reserved              |\n| STATUS_REG    | 0x12                  |\n| Default Value | 0                     |\n| Description   | Reserved              |\n| STATUS_REG    | 0x14                  |\n| Default Value | 0                     |\n| Decription    | Reserved              |",
                "char_count": 671,
                "token_estimate": 168
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Specification",
                "chunk_index": 17,
                "content": "**Note:You need to notice the power supply is lower than 17V and higher than 12V.**\n\n-   Automatically turn on speed alignment mode in PWM mode.That is the PWM of MotorA follows the PWM of the MotorB.\n\n` The value of PWM ranges from 0 to 1200.`\n` The value of speed ranges from 100 to 1300.`\n\n-   The register of 0x09 could set the MotorA and MotorB's status of direction.\n\n` When the value is 0x00,the MotorA and MotorB are CCW.`\n` When the value is 0x01,the MotorA is CW,MotorB is CCW.`\n` When the value is 0x02,the MotorA is CCW,MotorB is CW.`\n` When the value is 0x03,the MotorA is CCW,MotorB is CCW.`\n\n-   The register of 0x13 is the enable bit\n-   The register of 0x14 could set the Model of alignment\n\n** It won't automatically return to the default value, it will keep the last state when you start it.**\n\n` When the value is 0x00,the PWM of MotorA follows the PWM of the MotorB.`\n` When the value is 0x01,the PWM of MotorB follows the PWM of the MotorA.`\n\n-   The parameters of Motor\n\n` Power supply voltage:VM = 15 V(MAX)`\n` Output current:Iout = 1.2 A(ave)\/3.2 A(peak)`\n` Standby(power save)system`\n` CW\/CCW\/short break\/stop function modes`",
                "char_count": 1151,
                "token_estimate": 288
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Specification",
                "chunk_index": 18,
                "content": "-   We recommand you to buy our power board.So,you don't have to worry about the power.\n\n** Moreover,you need be careful to connect the Power Board.The Power Board is under the Motor Board.**\n\n-   When you set the value of register ,don't forget to set the value of 0x13.\n-   If your motors are connected properly and the power is on properly,the red LED on the motor will light up.",
                "char_count": 382,
                "token_estimate": 96
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Mechanical Drawing",
                "chunk_index": 19,
                "content": "<img src=\"DockerPi_Motor_Board(A).png\" title=\"DockerPi_Motor_Board(A).png\" width=\"500\" alt=\"DockerPi_Motor_Board(A).png\" \/>",
                "char_count": 123,
                "token_estimate": 31
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Configuring I2C(Raspberry Pi)",
                "chunk_index": 20,
                "content": "Run **sudo raspi-config** and follow the prompts to install i2c support for the ARM core and linux kernel\nGo to **Interfacing Options** <img src=\"Raspi-config-1.png\" title=\"Raspi-config-1.png\" width=\"320\" alt=\"Raspi-config-1.png\" \/> then **I2C** <img src=\"Raspi-config-2.png\" title=\"Raspi-config-2.png\" width=\"320\" alt=\"Raspi-config-2.png\" \/> Enable! <img src=\"Raspi-config-3.png\" title=\"Raspi-config-3.png\" width=\"320\" alt=\"Raspi-config-3.png\" \/> Done! <img src=\"Raspi-config-4.png\" title=\"Raspi-config-4.png\" width=\"320\" alt=\"Raspi-config-4.png\" \/>",
                "char_count": 550,
                "token_estimate": 138
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Direct control wtihout programming(Raspberry Pi)",
                "chunk_index": 21,
                "content": "-   Please do not set the value of register 0x13 more than 254,otherwise,it dosen't work.\n-   Set MotorA's speed of low 8 bits\n\n`i2cset -y 1 0x18 0x01 100`\n`i2cset -y 1 0x18 0x13 100`\n\n-   Set MotorA's speed of high 8 bits\n\n`i2cset -y 1 0x18 0x02 100`\n`i2cset -y 1 0x18 0x13 100`\n\n-   Set MotorA's count of low 8 bits\n\n`i2cset -y 1 0x18 0x05 100`\n`i2cset -y 1 0x18 0x13 100`\n\n-   Set MotorA's count of high 8 bits\n\n`i2cset -y 1 0x18 0x06 100`\n`i2cset -y 1 0x18 0x13 100`\n\n-   Set MotorA and MotorB's direction\n\n`i2cset -y 1 0x18 0x09 1`\n`i2cset -y 1 0x18 0x13 100`\n\n-   Query current MotorA's speed of low 8 bits\n\n`i2cget -y 1 0x18 0x0a`\n\n-   Query current MotorA's speed of high 8 bits\n\n`i2cget -y 1 0x18 0x0b`\n\n-   Query current MotorA's count of low 8 bits\n\n`i2cget -y 1 0x18 0x0e`\n\n-   Query current MotorA's count of high 8 bits\n\n`i2cget -y 1 0x18 0x0f`\n\n-   Query current MotorA and MotorB's direction\n\n`i2cget -y 1 0x18 0x12`",
                "char_count": 932,
                "token_estimate": 233
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Simple Test",
                "chunk_index": 22,
                "content": "-   Create a file and name it test.py,paste following codes and running.The phenomenon you see is that the motor accelerates to the maximum value first, then decelerates to the minimum value.\n\n<!-- -->\n\nimport smbus\n    import sys\n    import time\n\nMOTOR_DRIVER_ADDRESS = 0x18\n    MOTOR_DRIVER_BUS = 1\n    MOTOR_DRIVER_SPEED_A_L = 0x01\n    MOTOR_DRIVER_SPEED_A_H = 0x02\n    MOTOR_DRIVER_ENABLE = 0x13\n\nbus = smbus.SMBus(MOTOR_DRIVER_BUS)\n\nprint(\"Please set the value range from 100 to 1300\")\n    MOTOR_DRIVER_SPEED_SET_A = (int)(input(\"Set the speed of MOTOR_DRIVER_A:\"))\n    while(MOTOR_DRIVER_SPEED_SET_A < 1300):\n        MOTOR_DRIVER_SPEED_SET_A += 1\n        time.sleep(0.01)\n        bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_A_H,(MOTOR_DRIVER_SPEED_SET_A >> 8))\n        bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_A_L,(MOTOR_DRIVER_SPEED_SET_A & 0xff))\n        bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_ENABLE,0x10)\n\nif(MOTOR_DRIVER_SPEED_SET_A == 1300):\n        print(\"The speed is max\")\n    time.sleep(1)",
                "char_count": 1055,
                "token_estimate": 264
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Simple Test",
                "chunk_index": 23,
                "content": "while(MOTOR_DRIVER_SPEED_SET_A > 0):\n        MOTOR_DRIVER_SPEED_SET_A -= 1\n        time.sleep(0.01)\n        bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_A_H,(MOTOR_DRIVER_SPEED_SET_A >> 8))\n        bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_A_L,(MOTOR_DRIVER_SPEED_SET_A & 0xff))\n        bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_ENABLE,0x10)\n\nif(MOTOR_DRIVER_SPEED_SET_A == 0):\n        bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_A_L,0)\n        print(\"The speed is min\")",
                "char_count": 531,
                "token_estimate": 133
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Program in language C(Raspberrry Pi)",
                "chunk_index": 24,
                "content": "-   Create a new file named:Motor.c and paste following codes:\n\n<!-- -->\n\n#include <stdio.h>\n    #include <stdint.h>\n    #include <wiringPi.h>\n    #include <wiringPiI2C.h>\n\n\/\/MOTOR_DRIVER Address\n    #define DEVICE_ARRD 0x18\n\n\/\/Set the speed value of MOTOR_DRIVER\n    #define MOTOR_DRIVER_SPEED_SET_A 500\n    #define MOTOR_DRIVER_SPEED_SET_B 1000\n\n\/\/Set the status of MOTOR_DRIVER\n    #define MOTOR_DRIVER_DIRECTION_STATUS 0x01",
                "char_count": 427,
                "token_estimate": 107
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Program in language C(Raspberrry Pi)",
                "chunk_index": 25,
                "content": "\/\/The functions of MOTOR_DRIVER\n    #define MOTOR_DRIVER_SPEED_A_L 0x01\n    #define MOTOR_DRIVER_SPEED_A_H 0x02\n    #define MOTOR_DRIVER_SPEED_B_L 0x03\n    #define MOTOR_DRIVER_SPEED_B_H 0x04\n    #define MOTOR_DRIVER_COUNT_A_L 0x05\n    #define MOTOR_DRIVER_COUNT_A_H 0x06\n    #define MOTOR_DRIVER_COUNT_B_L 0x07\n    #define MOTOR_DRIVER_COUNT_B_H 0x08\n    #define MOTOR_DRIVER_DIRECTION 0x09\n    #define MOTOR_DRIVER_SPEED_NOW_A_L 0x0a\n    #define MOTOR_DRIVER_SPEED_NOW_A_H 0x0b\n    #define MOTOR_DRIVER_SPEED_NOW_B_L 0x0c\n    #define MOTOR_DRIVER_SPEED_NOW_B_H 0x0d\n    #define MOTOR_DRIVER_COUNT_NOW_A_L 0x0e\n    #define MOTOR_DRIVER_COUNT_NOW_A_H 0x0f\n    #define MOTOR_DRIVER_COUNT_NOW_B_L 0x10\n    #define MOTOR_DRIVER_COUNT_NOW_B_H 0x11\n    #define MOTOR_DRIVER_DIRECTION_NOW 0x12\n    #define MOTOR_DRIVER_ENABLE 0x13\n\nint main(void)\n    {\n        int device_addr;\n        int i = 0;\n        device_addr = wiringPiI2CSetup(DEVICE_ARRD);\n\nif (device_addr < 0)\n            printf(\"Extend board Can not be initialized, please enable I2C and try again!\\n\", device_addr);",
                "char_count": 1073,
                "token_estimate": 269
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Program in language C(Raspberrry Pi)",
                "chunk_index": 26,
                "content": "if (MOTOR_DRIVER_SPEED_SET_A <= 255)\n            printf(\"Now the speed of MOTOR_DRIVER_A is: %d\\n\" ,(int)(wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_SPEED_A_L)));\n        else\n            printf(\"Now the speed of MOTOR_DRIVER_A is: %d\\n\" ,(int)((wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_SPEED_NOW_A_H) << 8 | wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_SPEED_A_L))));\n        if (MOTOR_DRIVER_SPEED_SET_B <= 255)\n            printf(\"Now the speed of MOTOR_DRIVER_B is: %d\\n\" ,(int)(wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_SPEED_B_L)));\n        else\n            printf(\"Now the speed of MOTOR_DRIVER_B is: %d\\n\" ,(int)((wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_SPEED_NOW_B_H) << 8 | wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_SPEED_B_L))));\n\nif (((wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_DIRECTION_NOW) & 0x01) == 0x01))\n            printf(\"Now the direction of MOTOR_DRIVER_A is:CW\\n\");\n        else\n            printf(\"Now the direction of MOTOR_DRIVER_A is:CCW\\n\");",
                "char_count": 990,
                "token_estimate": 248
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Program in language C(Raspberrry Pi)",
                "chunk_index": 27,
                "content": "if (((wiringPiI2CReadReg8(device_addr,MOTOR_DRIVER_DIRECTION_NOW) & 0x02) == 0x02))\n            printf(\"Now the direction of MOTOR_DRIVER_B is:CW\\n\");\n        else\n            printf(\"Now the direction of MOTOR_DRIVER_B is:CCW\\n\");\n\nwiringPiI2CWriteReg8(device_addr,MOTOR_DRIVER_SPEED_A_L,(MOTOR_DRIVER_SPEED_SET_A & 0xff));\n        wiringPiI2CWriteReg8(device_addr,MOTOR_DRIVER_SPEED_A_H,(MOTOR_DRIVER_SPEED_SET_A >> 8));\n        wiringPiI2CWriteReg8(device_addr,MOTOR_DRIVER_SPEED_B_L,(MOTOR_DRIVER_SPEED_SET_B & 0xff));\n        wiringPiI2CWriteReg8(device_addr,MOTOR_DRIVER_SPEED_B_H,(MOTOR_DRIVER_SPEED_SET_B >> 8));\n        wiringPiI2CWriteReg8(device_addr,MOTOR_DRIVER_ENABLE,DEVICE_ARRD);\n    }\n\nCompile!\n\n`gcc Motor.c -lwiringPi -o Motor`\nExec It!\n\n`.\/Motor`",
                "char_count": 766,
                "token_estimate": 192
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language Python(Raspberry Pi)",
                "chunk_index": 28,
                "content": "-   Create a new file named:Motor.py and paste following codes:\n\n<!-- -->\n\nimport time as t\n    import smbus\n    import sys\n\n#MOTOR_DRIVER Address\n\nMOTOR_DRIVER_ADDRESS = 0x18\n    MOTOR_DRIVER_BUS = 1\n\n#Set the speed value of MOTOR_DRIVER\n    MOTOR_DRIVER_SPEED_SET_A = (int)(input(\"Set the speed of MOTOR_DRIVER_A:\"))\n    MOTOR_DRIVER_SPEED_SET_B = (int)(input(\"Set the speed of MOTOR_DRIVER_B:\"))\n\nMOTOR_DRIVER_SPEED_A_L = 0x01\n    MOTOR_DRIVER_SPEED_A_H = 0x02\n    MOTOR_DRIVER_SPEED_B_L = 0x03\n    MOTOR_DRIVER_SPEED_B_H = 0x04\n    MOTOR_DRIVER_COUNT_A_L = 0x05\n    MOTOR_DRIVER_COUNT_A_H = 0x06\n    MOTOR_DRIVER_COUNT_B_L = 0x07\n    MOTOR_DRIVER_COUNT_B_H = 0x08\n    MOTOR_DRIVER_DIRECTION = 0x09\n    MOTOR_DRIVER_SPEED_NOW_A_L = 0x0a\n    MOTOR_DRIVER_SPEED_NOW_A_H = 0x0b\n    MOTOR_DRIVER_SPEED_NOW_B_L = 0x0c\n    MOTOR_DRIVER_SPEED_NOW_B_H = 0x0d\n    MOTOR_DRIVER_COUNT_NOW_A_L = 0x0e\n    MOTOR_DRIVER_COUNT_NOW_A_H = 0x0f\n    MOTOR_DRIVER_COUNT_NOW_B_L = 0x10\n    MOTOR_DRIVER_COUNT_NOW_B_H = 0x11\n    MOTOR_DRIVER_DIRECTION_NOW = 0x12\n    MOTOR_DRIVER_ENABLE = 0x13\n\nbus = smbus.SMBus(MOTOR_DRIVER_BUS)",
                "char_count": 1111,
                "token_estimate": 278
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language Python(Raspberry Pi)",
                "chunk_index": 29,
                "content": "if MOTOR_DRIVER_SPEED_SET_A <= 255 :\n        print(\"Now the speed of MOTOR_DRIVER_A is:\" ,bus.read_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_NOW_A_L))\n    else :\n        print(\"Now the speed of MOTOR_DRIVER_A is:\" ,((bus.read_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_NOW_A_H)) << 8) | bus.read_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_NOW_A_L))\n\nif MOTOR_DRIVER_SPEED_SET_B <= 255 :\n        print(\"Now the speed of MOTOR_DRIVER_B is:\" ,bus.read_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_NOW_B_L))\n    else :\n        print(\"Now the speed of MOTOR_DRIVER_B is:\" ,((bus.read_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_NOW_B_H)) << 8) | bus.read_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_NOW_B_L))",
                "char_count": 742,
                "token_estimate": 186
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language Python(Raspberry Pi)",
                "chunk_index": 30,
                "content": "bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_A_H,(MOTOR_DRIVER_SPEED_SET_A >> 8))\n    bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_A_L,(MOTOR_DRIVER_SPEED_SET_A & 0xff))\n    bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_B_L,(MOTOR_DRIVER_SPEED_SET_B & 0xff))\n    bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_SPEED_B_H,(MOTOR_DRIVER_SPEED_SET_B >> 8))\n    bus.write_byte_data(MOTOR_DRIVER_ADDRESS,MOTOR_DRIVER_ENABLE,0x10)\n\nExecute it !\n\n`python3 Motor.py`",
                "char_count": 508,
                "token_estimate": 127
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language java(Raspberry Pi)",
                "chunk_index": 31,
                "content": "-   Create a new file named:Motor.java and paste following codes:\n\n<!-- -->\n\nimport java.io.IOException;\n    import java.util.Arrays;\n\nimport com.pi4j.io.i2c.I2CBus;\n    import com.pi4j.io.i2c.I2CDevice;\n    import com.pi4j.io.i2c.I2CFactory;\n    import com.pi4j.io.i2c.I2CFactory.UnsupportedBusNumberException;\n    import com.pi4j.platform.PlatformAlreadyAssignedException;\n    import com.pi4j.util.Console;\n\npublic class Motor {\n\n\/\/MOTOR_DRIVER Address\n        public static final int DOCKERPI_MOTORDRIVER_BOARD = 0x18;\n\npublic static final byte MOTOR_DRIVER_DIRECTION_STATUS_1 = (byte) 0x00;\n        public static final byte MOTOR_DRIVER_DIRECTION_STATUS_2 = (byte) 0x01;\n        public static final byte MOTOR_DRIVER_DIRECTION_STATUS_3 = (byte) 0x02;\n        public static final byte MOTOR_DRIVER_DIRECTION_STATUS_4 = (byte) 0x04;\n\n\/\/Set the speed value of MOTOR_DRIVER\n        public static final int MOTOR_DRIVER_SPEED_SET_A = 500;\n        public static final int MOTOR_DRIVER_SPEED_SET_B = 1000;\n        \/\/Set the status of MOTOR_DRIVER_DIRECTION\n        public static final byte MOTOR_DRIVER_DIRECTION_STATUS = (byte) 0x01;",
                "char_count": 1131,
                "token_estimate": 283
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language java(Raspberry Pi)",
                "chunk_index": 32,
                "content": "\/\/Set the count value of MOTOR_DRIVER\n        public static final int MOTOR_DRIVER_COUNT_SET_A = 500;\n        public static final int MOTOR_DRIVER_COUNT_SET_B = 1000;\n\n\/\/Motordriver functions\n        public static final byte MOTOR_DRIVER_SPEED_A_L = (byte) 0x01;\n        public static final byte MOTOR_DRIVER_SPEED_A_H = (byte) 0x02;\n        public static final byte MOTOR_DRIVER_SPEED_B_L = (byte) 0x03;\n        public static final byte MOTOR_DRIVER_SPEED_B_H = (byte) 0x04;\n        public static final byte MOTOR_DRIVER_COUNT_A_L = (byte) 0x05;\n        public static final byte MOTOR_DRIVER_COUNT_A_H = (byte) 0x06;\n        public static final byte MOTOR_DRIVER_COUNT_B_L = (byte) 0x07;\n        public static final byte MOTOR_DRIVER_COUNT_B_H = (byte) 0x08;\n\npublic static final byte MOTOR_DRIVER_DIRECTION = (byte) 0x09;\n\npublic static final byte MOTOR_DRIVER_SPEED_NOW_A_L = (byte) 0x0a;\n        public static final byte MOTOR_DRIVER_SPEED_NOW_A_H = (byte) 0x0b;\n        public static final byte MOTOR_DRIVER_SPEED_NOW_B_L = (byte) 0x0c;\n        public static final byte MOTOR_DRIVER_SPEED_NOW_B_H = (byte) 0x0d;\n\npublic static final byte MOTOR_DRIVER_COUNT_NOW_A_L = (byte) 0x0e;",
                "char_count": 1184,
                "token_estimate": 296
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language java(Raspberry Pi)",
                "chunk_index": 33,
                "content": "public static final byte MOTOR_DRIVER_COUNT_NOW_A_H = (byte) 0x0f;\n        public static final byte MOTOR_DRIVER_COUNT_NOW_B_L = (byte) 0x10;\n        public static final byte MOTOR_DRIVER_COUNT_NOW_B_H = (byte) 0x11;\n        public static final byte MOTOR_DRIVER_DIRECTION_NOW = (byte) 0x12;\n        public static final byte MOTOR_DRIVER_ENABLE = (byte) 0x13;\n\npublic static void main(String[] args)\n                throws InterruptedException, PlatformAlreadyAssignedException, IOException, UnsupportedBusNumberException {\n\nfinal Console console = new Console();\n\nI2CBus i2c = I2CFactory.getInstance(I2CBus.BUS_1);\n                    I2CDevice device = i2c.getDevice(DOCKERPI_MOTORDRIVER_BOARD);\n\nif (MOTOR_DRIVER_SPEED_SET_A <= 255)\n                        console.println(\"Now the speed of MOTOR_DRIVER_A is:\" + (device.read(MOTOR_DRIVER_SPEED_NOW_A_L)));\n                    else\n                        console.println(\"Now the speed of MOTOR_DRIVER_A is:\" + (device.read(MOTOR_DRIVER_SPEED_NOW_A_L) | (device.read(MOTOR_DRIVER_SPEED_NOW_A_H) << 8)));\n\n\/\/device.write(MOTOR_DRIVER_DIRECTION,(byte)0x01);",
                "char_count": 1109,
                "token_estimate": 278
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language java(Raspberry Pi)",
                "chunk_index": 34,
                "content": "\/\/device.write(MOTOR_DRIVER_COUNT_A_L,(byte)((MOTOR_DRIVER_COUNT_SET_A_L) & 0xff));\n                    \/\/device.write(MOTOR_DRIVER_COUNT_A_H,(byte)(MOTOR_DRIVER_COUNT_SET_A_H >> 8));\n\nif (MOTOR_DRIVER_SPEED_SET_B <= 255)\n                        console.println(\"Now the speed of MOTOR_DRIVER_B is:\" + device.read(MOTOR_DRIVER_SPEED_NOW_B_L));\n                    else\n                        console.println(\"Now the speed of MOTOR_DRIVER_B is:\" + (device.read(MOTOR_DRIVER_SPEED_NOW_B_L) | (device.read(MOTOR_DRIVER_SPEED_NOW_B_H) << 8)));\n\nif ((device.read(MOTOR_DRIVER_DIRECTION_NOW) & 0x01) == 0x01)\n                        console.println(\"Now the direction of MOTOR_DRIVER_A is:CW\");\n                    else\n                        console.println(\"Now the direction of MOTOR_DRIVER_A is:CCW\");\n\nif ((device.read(MOTOR_DRIVER_DIRECTION_NOW) & 0x02) == 0x02)\n                        console.println(\"Now the direction of MOTOR_DRIVER_B is:CW\");\n                    else\n                        console.println(\"Now the direction of MOTOR_DRIVER_B is:CCW\");",
                "char_count": 1063,
                "token_estimate": 266
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Progarm in language java(Raspberry Pi)",
                "chunk_index": 35,
                "content": "device.write(MOTOR_DRIVER_DIRECTION,MOTOR_DRIVER_DIRECTION_STATUS);\n                    device.write(MOTOR_DRIVER_SPEED_B_L,(byte)((MOTOR_DRIVER_SPEED_SET_B) & 0xff));\n                    device.write(MOTOR_DRIVER_SPEED_B_H,(byte)(MOTOR_DRIVER_SPEED_SET_B >> 8));\n\ndevice.write(MOTOR_DRIVER_SPEED_A_L,(byte)((MOTOR_DRIVER_SPEED_SET_A) & 0xff));\n                    device.write(MOTOR_DRIVER_SPEED_A_H,(byte)(MOTOR_DRIVER_SPEED_SET_A >> 8));\n\ndevice.write(MOTOR_DRIVER_ENABLE,(byte)0x02);\n                }\n    }\n\n-   Compile it and running:\n\n<!-- -->\n\njavac Motor.java -classpath .:classes:\/opt\/pi4j\/lib\/'*'\n\nsudo java -classpath .:classes:\/opt\/pi4j\/lib\/'*' Motor",
                "char_count": 663,
                "token_estimate": 166
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "FAQ",
                "chunk_index": 36,
                "content": "-   Q: If i set some value of register address,but the Motor has no response,what can i do for it?\n\n` A: Firstly,please check the power supply port.`\n`    Secondly,you need to check whether you open I2C.`\n`    Thirdly,you may not set the value of register address :\"0x13\" and \"0x09\"`\n\n-   Q: If i directly control it without programming,when i finish setting the value,but the motor doesn't work.\n\n` A: Please try to set the value of register 0x13 again.`",
                "char_count": 455,
                "token_estimate": 114
            },
            {
                "title": "EP-0108",
                "rev_id": 10668,
                "heading_path": "Keywords",
                "chunk_index": 37,
                "content": "Motor,DockerPi,Hat,Stack",
                "char_count": 24,
                "token_estimate": 6
            }
        ]
    }
}