├── README.md
├── README_zh.md
├── arduino_lib
├── examples
│ ├── base
│ │ ├── gpio_step_test
│ │ │ └── gpio_step_test.ino
│ │ ├── gpio_test
│ │ │ └── gpio_test.ino
│ │ ├── ps2_test
│ │ │ ├── PS2X_lib.cpp
│ │ │ ├── PS2X_lib.h
│ │ │ └── ps2_test.ino
│ │ └── pwm_test
│ │ │ └── pwm_test.ino
│ ├── comprehensive
│ │ ├── bluetooth_wifi_control
│ │ │ ├── BluetoothHandle.h
│ │ │ ├── Protocol.h
│ │ │ ├── ProtocolParser.cpp
│ │ │ ├── ProtocolParser.h
│ │ │ ├── bluetooth_wifi_control.ino
│ │ │ ├── debug.cpp
│ │ │ └── debug.h
│ │ ├── ps2_control_4wd
│ │ │ ├── PS2X_lib.cpp
│ │ │ ├── PS2X_lib.h
│ │ │ └── ps2_control_4wd.ino
│ │ ├── ps2_control_4wd_with_robotic_arm
│ │ │ ├── PS2X_lib.cpp
│ │ │ ├── PS2X_lib.h
│ │ │ └── ps2_control_4wd_with_robotic_arm.ino
│ │ └── ps2_control_mecanum_wheel_car
│ │ │ ├── PS2X_lib.cpp
│ │ │ ├── PS2X_lib.h
│ │ │ └── ps2_control_mecanum_wheel_car.ino
│ └── motor_test
│ │ ├── dc
│ │ └── dc.ino
│ │ ├── encoder
│ │ └── encoder.ino
│ │ ├── encoder_pid
│ │ └── encoder_pid.ino
│ │ ├── servo
│ │ └── servo.ino
│ │ └── stepper
│ │ └── stepper.ino
├── keywords.txt
├── library.properties
└── src
│ ├── Emakefun_MS_PWMServoDriver.cpp
│ ├── Emakefun_MS_PWMServoDriver.h
│ ├── Emakefun_MotorDriver.cpp
│ ├── Emakefun_MotorDriver.h
│ ├── MsTimer2.cpp
│ ├── MsTimer2.h
│ ├── PID_v1.cpp
│ ├── PID_v1.h
│ └── PinChangeInt.h
├── doc
├── MotorDriverBoard_V5.2.pdf
├── PCA9685.pdf
└── picture
│ ├── EN
│ ├── MotorDriverBoard_show0.jpg
│ ├── MotorDriverBoard_show1.png
│ ├── back.png
│ ├── dc_dc_servo.png
│ ├── dc_power_supply.png
│ ├── extra_power_supply.png
│ ├── hardwareIntroduction.jpg
│ ├── mblock
│ │ ├── dc_init.png
│ │ ├── init.png
│ │ ├── init_encoder.png
│ │ ├── run_dc.png
│ │ ├── run_encoder.png
│ │ ├── run_servo.png
│ │ ├── run_stepper.png
│ │ ├── servo_init.png
│ │ ├── set_freq.png
│ │ ├── set_mode.png
│ │ ├── set_pwm.png
│ │ ├── stepper_init.png
│ │ ├── stop_dc.png
│ │ ├── stop_encoder.png
│ │ └── stop_stepper.png
│ ├── md_stepper.png
│ ├── pid_encoder.jpg
│ ├── power_supply.png
│ ├── servo.png
│ ├── terminal_power_servo.png
│ └── terminal_power_supply.png
│ └── ZH
│ ├── MotorDriverBoard_show0.jpg
│ ├── MotorDriverBoard_show1.png
│ ├── Ps2.png
│ ├── dc.png
│ ├── dc_power_supply.png
│ ├── dc_test.png
│ ├── encoder.png
│ ├── encoder_test.png
│ ├── examples.png
│ ├── gpio_test.png
│ ├── hardwareIntroduction.png
│ ├── mblock
│ ├── dc_init.png
│ ├── download.png
│ ├── init.png
│ ├── init_encoder.png
│ ├── mb_install_success.png
│ ├── run_dc.png
│ ├── run_encoder.png
│ ├── run_servo.png
│ ├── run_stepper.png
│ ├── servo_init.png
│ ├── set_freq.png
│ ├── set_mode.png
│ ├── set_pwm.png
│ ├── stepper_init.png
│ ├── stop_dc.png
│ ├── stop_encoder.png
│ └── stop_stepper.png
│ ├── mind+
│ ├── dc_init.png
│ ├── extention-pkg.png
│ ├── init.png
│ ├── init_encoder.png
│ ├── mindplus-ps2.png
│ ├── pwm.png
│ ├── readDegrees.png
│ ├── run_dc.png
│ ├── run_encoder.png
│ ├── run_servo.png
│ ├── run_stepper.png
│ ├── servo_init.png
│ ├── set_freq.png
│ ├── set_mode.png
│ ├── stepper.png
│ ├── stop_dc.png
│ ├── stop_encoder.png
│ ├── stop_stepper.png
│ ├── user-lib-step01.png
│ ├── user-lib-step02.png
│ ├── user-lib-step03.png
│ ├── user-lib-step04.png
│ └── user-lib-step05.png
│ ├── mixly
│ ├── dc_init.png
│ ├── download.png
│ ├── init_encoder.png
│ ├── install_success.png
│ ├── local_install.png
│ ├── mixly_guanli.png
│ ├── mixly_init.png
│ ├── mixly_kuanzhuang.png
│ ├── mixly_success.png
│ ├── run_dc.png
│ ├── run_encoder.png
│ ├── run_servo.png
│ ├── run_stepper.png
│ ├── select_xml.png
│ ├── servo_init.png
│ ├── set_freq.png
│ ├── set_mode.png
│ ├── set_pwm.png
│ ├── stepper_init.png
│ ├── stop_dc.png
│ ├── stop_encoder.png
│ └── stop_stepper.png
│ ├── pid.png
│ ├── pid_i.png
│ ├── pid_p.png
│ ├── ps2_test.png
│ ├── pwm_test.png
│ ├── servo.png
│ ├── servo_test.png
│ ├── stepper.png
│ ├── stepper_test.png
│ ├── terminal_power_servo.png
│ └── terminal_power_supply.png
├── example
├── mblock5
│ ├── dc_test.mblock
│ ├── encoder_test.mblock
│ ├── gpio_test.mblock
│ ├── ps2_test.mblock
│ ├── pwm_test.mblock
│ ├── servo_test.mblock
│ └── stepper_test.mblock
├── mind+
│ ├── DCMotorExample.mp
│ ├── EncoderMotorExample.mp
│ ├── PS2ControlCar.mp
│ ├── PS2TestExample.mp
│ ├── ServoMotorExample.mp
│ └── StepperMotorExample.mp
└── mixly
│ ├── PS2ControlCar.zip
│ ├── dc_test.zip
│ ├── encoder_test.zip
│ ├── gpio_test.zip
│ ├── ps2_test.zip
│ ├── pwm_test.zip
│ ├── servo_test.zip
│ └── stepper_test.zip
├── mblock5
└── ext_motordriverboard.mext
├── mind+
└── ext-MotorDriverBoard
│ ├── arduinoC
│ ├── _images
│ │ ├── featured.png
│ │ └── icon.svg
│ ├── _locales
│ │ └── zh-cn.json
│ ├── _menus
│ │ ├── arduino.json
│ │ └── mega2560.json
│ └── main.ts
│ └── config.json
└── mixly
├── MotorDriverBoard.xml
├── block
└── MotorDriverBoard.js
├── generator
└── MotorDriverBoard.js
├── language
└── MotorDriverBoard
│ ├── en.js
│ ├── zh-hans.js
│ └── zh-hant.js
└── media
└── Motordriverboard
└── em_md_qr.png
/arduino_lib/examples/base/gpio_step_test/gpio_step_test.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 |
3 | #define IN1 5 //A+
4 | #define IN2 7 //A-
5 | #define IN3 4 //B+
6 | #define IN4 2 //B-
7 | #define TIME 1000
8 | Emakefun_MotorDriver gpio = Emakefun_MotorDriver(0x60);
9 |
10 | Emakefun_MotorDriver gpio = Emakefun_MotorDriver(0x60);
11 |
12 | void setup() {
13 | Serial.begin(9600);
14 | Serial.println("GPIO test!");
15 | gpio.begin(1600);
16 | }
17 |
18 | void onesteps()
19 | {
20 | gpio.setPin(IN1, HIGH);
21 | // gpio.setPin(IN2, LOW);
22 | // gpio.setPin(IN3, LOW);
23 | gpio.setPin(IN4, LOW);
24 | delayMicroseconds(TIME);
25 |
26 | gpio.setPin(IN1, LOW);
27 | // gpio.setPin(IN2, LOW);
28 | gpio.setPin(IN3, HIGH);
29 | // gpio.setPin(IN4, LOW);
30 | delayMicroseconds(TIME);
31 |
32 | gpio.setPin(IN3, LOW);
33 | gpio.setPin(IN2, HIGH);
34 | // gpio.setPin(IN1, LOW);
35 | // gpio.setPin(IN4, LOW);
36 | delayMicroseconds(TIME);
37 |
38 | gpio.setPin(IN2, LOW);
39 | // gpio.setPin(IN1, LOW);
40 | // gpio.setPin(IN3, LOW);
41 | gpio.setPin(IN4, HIGH);
42 | delayMicroseconds(TIME);
43 | }
44 |
45 | void StepStop()
46 | {
47 | gpio.setPin(IN1, LOW);
48 | gpio.setPin(IN2, LOW);
49 | gpio.setPin(IN3, LOW);
50 | gpio.setPin(IN4, LOW);
51 | }
52 |
53 | void loop() {
54 | // put your main code here, to run repeatedly:
55 | for (int i = 0; i < 200; i++) {
56 | onesteps();
57 | }
58 | StepStop();
59 | delay(2000);
60 | }
61 |
--------------------------------------------------------------------------------
/arduino_lib/examples/base/gpio_test/gpio_test.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 | Emakefun_MotorDriver gpio = Emakefun_MotorDriver(0x60);
3 |
4 | void setup() {
5 | Serial.begin(9600);
6 | Serial.println("GPIO test!");
7 | gpio.begin(1000);
8 | }
9 |
10 | void loop() {
11 | gpio.setPin(S1, HIGH);
12 | delay(1000);
13 | gpio.setPin(S1, LOW);
14 | delay(1000);
15 | }
16 |
--------------------------------------------------------------------------------
/arduino_lib/examples/base/ps2_test/PS2X_lib.h:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * Super amazing PS2 controller Arduino Library v1.8
3 | * details and example sketch:
4 | * http://www.billporter.info/?p=240
5 | *
6 | * Original code by Shutter on Arduino Forums
7 | *
8 | * Revamped, made into lib by and supporting continued development:
9 | * Bill Porter
10 | * www.billporter.info
11 | *
12 | * Contributers:
13 | * Eric Wetzel (thewetzel@gmail.com)
14 | * Kurt Eckhardt
15 | *
16 | * Lib version history
17 | * 0.1 made into library, added analog stick support.
18 | * 0.2 fixed config_gamepad miss-spelling
19 | * added new functions:
20 | * NewButtonState();
21 | * NewButtonState(unsigned int);
22 | * ButtonPressed(unsigned int);
23 | * ButtonReleased(unsigned int);
24 | * removed 'PS' from begining of ever function
25 | * 1.0 found and fixed bug that wasn't configuring controller
26 | * added ability to define pins
27 | * added time checking to reconfigure controller if not polled enough
28 | * Analog sticks and pressures all through 'ps2x.Analog()' function
29 | * added:
30 | * enableRumble();
31 | * enablePressures();
32 | * 1.1
33 | * added some debug stuff for end user. Reports if no controller found
34 | * added auto-increasing sentence delay to see if it helps compatibility.
35 | * 1.2
36 | * found bad math by Shutter for original clock. Was running at 50kHz, not the required 500kHz.
37 | * fixed some of the debug reporting.
38 | * 1.3
39 | * Changed clock back to 50kHz. CuriousInventor says it's suppose to be 500kHz, but doesn't seem to work for everybody.
40 | * 1.4
41 | * Removed redundant functions.
42 | * Fixed mode check to include two other possible modes the controller could be in.
43 | * Added debug code enabled by compiler directives. See below to enable debug mode.
44 | * Added button definitions for shapes as well as colors.
45 | * 1.41
46 | * Some simple bug fixes
47 | * Added Keywords.txt file
48 | * 1.5
49 | * Added proper Guitar Hero compatibility
50 | * Fixed issue with DEBUG mode, had to send serial at once instead of in bits
51 | * 1.6
52 | * Changed config_gamepad() call to include rumble and pressures options
53 | * This was to fix controllers that will only go into config mode once
54 | * Old methods should still work for backwards compatibility
55 | * 1.7
56 | * Integrated Kurt's fixes for the interrupts messing with servo signals
57 | * Reorganized directory so examples show up in Arduino IDE menu
58 | * 1.8
59 | * Added Arduino 1.0 compatibility.
60 | * 1.9
61 | * Kurt - Added detection and recovery from dropping from analog mode, plus
62 | * integreated Chipkit (pic32mx...) support
63 | *
64 | *
65 | *
66 | *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version.
67 | This program is distributed in the hope that it will be useful,
68 | but WITHOUT ANY WARRANTY; without even the implied warranty of
69 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70 | GNU General Public License for more details.
71 |
72 | *
73 | ******************************************************************/
74 |
75 | // $$$$$$$$$$$$ DEBUG ENABLE SECTION $$$$$$$$$$$$$$$$
76 | // to debug ps2 controller, uncomment these two lines to print out debug to uart
77 | #define PS2X_DEBUG
78 | //#define PS2X_COM_DEBUG
79 |
80 | #ifndef PS2X_lib_h
81 | #define PS2X_lib_h
82 |
83 | #if ARDUINO > 22
84 | #include "Arduino.h"
85 | #else
86 | #include "WProgram.h"
87 | #endif
88 |
89 | #include
90 | #include
91 | #include
92 | #ifdef __AVR__
93 | // AVR
94 | #include
95 | #define CTRL_CLK 4
96 | #define CTRL_BYTE_DELAY 3
97 | #else
98 | // Pic32...
99 | #include
100 | #define CTRL_CLK 5
101 | #define CTRL_CLK_HIGH 5
102 | #define CTRL_BYTE_DELAY 4
103 | #endif
104 |
105 | //These are our button constants
106 | #define PSB_SELECT 0x0001
107 | #define PSB_L3 0x0002
108 | #define PSB_R3 0x0004
109 | #define PSB_START 0x0008
110 | #define PSB_PAD_UP 0x0010
111 | #define PSB_PAD_RIGHT 0x0020
112 | #define PSB_PAD_DOWN 0x0040
113 | #define PSB_PAD_LEFT 0x0080
114 | #define PSB_L2 0x0100
115 | #define PSB_R2 0x0200
116 | #define PSB_L1 0x0400
117 | #define PSB_R1 0x0800
118 | #define PSB_GREEN 0x1000
119 | #define PSB_RED 0x2000
120 | #define PSB_BLUE 0x4000
121 | #define PSB_PINK 0x8000
122 | #define PSB_TRIANGLE 0x1000
123 | #define PSB_CIRCLE 0x2000
124 | #define PSB_CROSS 0x4000
125 | #define PSB_SQUARE 0x8000
126 |
127 | //Guitar button constants
128 | #define UP_STRUM 0x0010
129 | #define DOWN_STRUM 0x0040
130 | #define STAR_POWER 0x0100
131 | #define GREEN_FRET 0x0200
132 | #define YELLOW_FRET 0x1000
133 | #define RED_FRET 0x2000
134 | #define BLUE_FRET 0x4000
135 | #define ORANGE_FRET 0x8000
136 | #define WHAMMY_BAR 8
137 |
138 | //These are stick values
139 | #define PSS_RX 5
140 | #define PSS_RY 6
141 | #define PSS_LX 7
142 | #define PSS_LY 8
143 |
144 | //These are analog buttons
145 | #define PSAB_PAD_RIGHT 9
146 | #define PSAB_PAD_UP 11
147 | #define PSAB_PAD_DOWN 12
148 | #define PSAB_PAD_LEFT 10
149 | #define PSAB_L2 19
150 | #define PSAB_R2 20
151 | #define PSAB_L1 17
152 | #define PSAB_R1 18
153 | #define PSAB_GREEN 13
154 | #define PSAB_RED 14
155 | #define PSAB_BLUE 15
156 | #define PSAB_PINK 16
157 | #define PSAB_TRIANGLE 13
158 | #define PSAB_CIRCLE 14
159 | #define PSAB_CROSS 15
160 | #define PSAB_SQUARE 16
161 |
162 | #define SET(x,y) (x|=(1<
6 | #include
7 |
8 | #define BUFFER_SIZE 32
9 |
10 | typedef enum
11 | {
12 | E_BLUETOOTH_CONTROL = 0,
13 | E_INFRARED_REMOTE_CONTROL,
14 | E_INFRARED_TRACKING_MODE,
15 | E_INFRARED_AVOIDANCE_MODE,
16 | E_ULTRASONIC_AVOIDANCE,
17 | E_PS2_REMOTE_CONTROL,
18 | E_NRF24L01_CONTROL,
19 | E_ULTRASONIC_INFRARED_AVOIDANCE,
20 | E_PIANO_MODE,
21 | E_RGB_MODE,
22 | E_LED_MAXTRIX_MODE,
23 | E_CMD_LINE_MODE,
24 | E_LIGHT_SEEKING_MODE,
25 | E_ULTRASONIC_FOLLOW_MODE,
26 | E_SMARTCAR_CONTROL_MAX,
27 | } E_SMARTCAR_CONTROL_MODE;
28 |
29 | typedef enum
30 | {
31 | E_FORWARD = 0,
32 | E_BACK,
33 | E_LEFT,
34 | E_RIGHT,
35 | E_RIGHT_ROTATE,
36 | E_LEFT_ROTATE,
37 | E_STOP,
38 | E_RUNNING,
39 | E_SPEED_UP,
40 | E_SPEED_DOWN,
41 | E_LOW_POWER,
42 | } E_SMARTCAR_STATUS;
43 |
44 | class ProtocolParser
45 | {
46 | public:
47 | ProtocolParser(byte header = PROTOCOL_START_CODE, byte end = PROTOCOL_END_CODE);
48 | ~ProtocolParser();
49 | bool RecevData(byte *data, size_t len);
50 | bool RecevData(void);
51 | bool ParserPackage(byte *data = NULL);
52 | E_TYPE GetRobotType(void);
53 | uint8_t GetRobotAddr(void);
54 | E_CONTOROL_FUNC GetRobotControlFun(void);
55 | int GetRobotSpeed(void);
56 | int GetRobotDegree(void);
57 | int GetServoDegree(void);
58 | int GetServoDegreeNum(void);
59 | uint16_t GetBluetoothButton();
60 | bool GetBluetoothButton(uint16_t Button);
61 | // E_BUZZER_TYPE GetBuzzerMode(void);
62 | uint16_t GetBuzzerNote(void);
63 | uint8_t GetBuzzerSound(void);
64 | // ST_MUSIC_TYPE GetBuzzerMusic(void);
65 | long GetRgbValue(void);
66 | byte GetRgbEffect(void);
67 | byte GetRgbMode(void);
68 | byte* GetCmdLine(void);
69 | bool SendPackage(ST_PROTOCOL *send_dat, int len);
70 | E_SMARTCAR_CONTROL_MODE GetControlMode(void);
71 | uint8_t GetProtocolDataLength(void);
72 |
73 | private:
74 | byte buffer[BUFFER_SIZE];
75 | byte m_StartCode, m_EndCode;
76 | ST_PROTOCOL *recv;
77 | uint8_t protocol_data_len;
78 | bool m_recv_flag, m_send_success; // recevive flag
79 | byte *m_pHeader; // protocol header
80 | uint8_t m_PackageLength; // recevie package length
81 | uint16_t m_CheckSum;
82 | uint8_t m_RecvDataIndex; // get recevie data index
83 | char GetHeader(size_t index);
84 | uint8_t GetPackageLength(void);
85 | uint16_t GetCheckSum(void); // get package check sum
86 | };
87 |
88 | #endif // _PROTOCOLPARSER_H_
89 |
--------------------------------------------------------------------------------
/arduino_lib/examples/comprehensive/bluetooth_wifi_control/bluetooth_wifi_control.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 | #include "ProtocolParser.h"
3 | #include "BluetoothHandle.h"
4 |
5 | #define M1 1
6 | #define M2 2
7 | #define M3 3
8 | #define M4 4
9 |
10 | ProtocolParser *mProtocol = new ProtocolParser();
11 | Emakefun_MotorDriver mMotor = Emakefun_MotorDriver(0x60);
12 | Emakefun_DCMotor *LeftFoward, *RightFoward, *LeftBackward, *RightBackward;
13 |
14 | int Speed;
15 |
16 | void moto_init(int leftward, int rightfoward, int leftbackward, int rightbackward)
17 | {
18 |
19 | LeftFoward = mMotor.getMotor(leftward);
20 | RightFoward = mMotor.getMotor(rightfoward);
21 | LeftBackward = mMotor.getMotor(leftbackward);
22 | RightBackward = mMotor.getMotor(rightbackward);
23 | delay(200);
24 | mMotor.begin(50);
25 | }
26 |
27 | void SetSpeed(int8_t s)
28 | {
29 | if (s > 100) {
30 | Speed = 100;
31 | return;
32 | } else if (s < 0) {
33 | Speed = 0;
34 | return;
35 | }
36 | Speed = s;
37 | }
38 |
39 | int GetSpeed(void)
40 | {
41 | return Speed;
42 | }
43 |
44 | void SpeedUp(int8_t Duration)
45 | {
46 | SetSpeed(Speed + Duration);
47 | }
48 |
49 | void SpeedDown(int8_t Duration )
50 | {
51 | SetSpeed(Speed - Duration);
52 | }
53 |
54 | void DriveSpeed(int s)
55 | {
56 | if (s >= 0 && s <= 100) {
57 | LeftFoward->setSpeed((s / 10) * 25.5);
58 | RightFoward->setSpeed((s / 10) * 25.5);
59 | LeftBackward->setSpeed((s / 10) * 25.5);
60 | RightBackward->setSpeed((s / 10) * 25.5);
61 | }
62 | }
63 |
64 | void GoForward(void)
65 | {
66 | DriveSpeed(Speed);
67 | LeftFoward->run(FORWARD);
68 | RightFoward->run(FORWARD);
69 | LeftBackward->run(FORWARD);
70 | RightBackward->run(FORWARD);
71 | }
72 |
73 | void GoBack(void)
74 | {
75 | DriveSpeed(Speed);
76 | LeftFoward->run(BACKWARD);
77 | RightFoward->run(BACKWARD);
78 | LeftBackward->run(BACKWARD);
79 | RightBackward->run(BACKWARD);
80 | }
81 | void KeepStop(void)
82 | {
83 | DriveSpeed(0);
84 | LeftFoward->run(BRAKE);
85 | RightFoward->run(BRAKE);
86 | LeftBackward->run(BRAKE);
87 | RightBackward->run(BRAKE);
88 | }
89 |
90 | void TurnLeft(void)
91 | {
92 | int s;
93 | s = (Speed / 10) * 25.5;
94 | LeftFoward->setSpeed(s/2);
95 | LeftBackward->setSpeed(s/2);
96 | RightFoward->setSpeed(s);
97 | RightBackward->setSpeed(s);
98 | LeftFoward->run(FORWARD);
99 | RightFoward->run(FORWARD);
100 | LeftBackward->run(FORWARD);
101 | RightBackward->run(FORWARD);
102 | }
103 |
104 | void TurnRight(void)
105 | {
106 | int s;
107 | s = (Speed / 10) * 25.5;
108 | LeftFoward->setSpeed(s);
109 | LeftBackward->setSpeed(s);
110 | RightFoward->setSpeed(s/2);
111 | RightBackward->setSpeed(s/2);
112 | LeftFoward->run(FORWARD);
113 | RightFoward->run(FORWARD);
114 | LeftBackward->run(FORWARD);
115 | RightBackward->run(FORWARD);
116 | }
117 |
118 | void TurnLeftRotate(void)
119 | {
120 | DriveSpeed(Speed);
121 | LeftFoward->run(BACKWARD);
122 | LeftBackward->run(BACKWARD);
123 | RightFoward->run(FORWARD);
124 | RightBackward->run(FORWARD);
125 | }
126 |
127 | void TurnRightRotate(void)
128 | {
129 | DriveSpeed(Speed);
130 | LeftFoward->run(FORWARD);
131 | LeftBackward->run(FORWARD);
132 | RightFoward->run(BACKWARD);
133 | RightBackward->run(BACKWARD);
134 | }
135 |
136 | void Drive(int degree)
137 | {
138 | byte value = (Speed / 10) * 25.5; //app contol hbot_speed is 0 ~ 100 ,pwm is 0~255
139 | float f;
140 | if (degree >= 0 && degree <= 90) {
141 | f = (float)(degree) / 90;
142 | LeftFoward->setSpeed(value);
143 | RightFoward->setSpeed((float)(value * f));
144 | LeftBackward->setSpeed(value);
145 | RightBackward->setSpeed((float)(value * f));
146 | LeftFoward->run(FORWARD);
147 | RightFoward->run(FORWARD);
148 | LeftBackward->run(FORWARD);
149 | RightBackward->run(FORWARD);
150 | } else if (degree > 90 && degree <= 180) {
151 | f = (float)(180 - degree) / 90;
152 | LeftFoward->setSpeed((float)(value * f));
153 | RightFoward->setSpeed(value);
154 | LeftBackward->setSpeed((float)(value * f));
155 | RightBackward->setSpeed(value);
156 | LeftFoward->run(FORWARD);
157 | RightFoward->run(FORWARD);
158 | LeftBackward->run(FORWARD);
159 | RightBackward->run(FORWARD);
160 | } else if (degree > 180 && degree <= 270) {
161 | f = (float)(degree - 180) / 90;
162 | LeftFoward->setSpeed((float)(value * f));
163 | RightFoward->setSpeed(value);
164 | LeftBackward->setSpeed((float)(value * f));
165 | RightBackward->setSpeed(value);
166 | LeftFoward->run(BACKWARD);
167 | RightFoward->run(BACKWARD);
168 | LeftBackward->run(BACKWARD);
169 | RightBackward->run(BACKWARD);
170 | } else if (degree > 270 && degree <= 360) {
171 | f = (float)(360 - degree) / 90;
172 | LeftFoward->setSpeed(value);
173 | RightFoward->setSpeed((float)(value * f));
174 | LeftBackward->setSpeed(value);
175 | RightBackward->setSpeed((float)(value * f));
176 | LeftFoward->run(BACKWARD);
177 | RightFoward->run(BACKWARD);
178 | LeftBackward->run(BACKWARD);
179 | RightBackward->run(BACKWARD);
180 | }
181 | else {
182 | KeepStop();
183 | return;
184 | }
185 | }
186 |
187 | void HandleBluetoothRemote(bool recv_flag)
188 | {
189 | if (recv_flag) {
190 | switch (mProtocol->GetRobotControlFun()) {
191 | case E_BUTTON:
192 | switch (mProtocol->GetBluetoothButton())
193 | {
194 | case BT_PAD_UP:
195 | GoForward();
196 | break;
197 | case BT_PAD_DOWN:
198 | GoBack();
199 | break;
200 | case BT_PAD_LEFT:
201 | Drive(160);
202 | break;
203 | case BT_PAD_RIGHT:
204 | Drive(20);
205 | break;
206 | case BT_PINK:
207 | TurnLeft();
208 | break;
209 | case BT_RED:
210 | TurnRight();
211 | break;
212 | case BT_GREEN:
213 | SpeedUp(10);
214 | break;
215 | case BT_BLUE:
216 | SpeedDown(10);
217 | break;
218 | case BT_L1:
219 | SpeedUp(10);
220 | break;
221 | case BT_R1:
222 | SpeedDown(10);
223 | break;
224 | }
225 | break;
226 | case E_ROBOT_CONTROL_DIRECTION:
227 | Drive(mProtocol->GetRobotDegree());
228 | break;
229 | case E_ROBOT_CONTROL_SPEED:
230 | SetSpeed(mProtocol->GetRobotSpeed());
231 | break ;
232 | default:
233 | break;
234 | }
235 | }
236 | }
237 |
238 | void setup()
239 | {
240 | Serial.begin(9600);
241 | moto_init(M2, M1, M4, M3);
242 | SetSpeed(100);
243 | }
244 |
245 | void loop()
246 | {
247 | static byte mode;
248 | static bool recv_flag;
249 | mProtocol->RecevData();
250 |
251 | if (recv_flag = mProtocol->ParserPackage()) {
252 | if (mProtocol->GetRobotControlFun() == E_CONTROL_MODE) {
253 | Serial.print("GetControlMode: ");
254 | Serial.println(mProtocol->GetControlMode());
255 | return;
256 | }
257 | }
258 | switch (mProtocol->GetControlMode()) {
259 | case E_BLUETOOTH_CONTROL:
260 | HandleBluetoothRemote(recv_flag);
261 | break;
262 | default:
263 | break;
264 | }
265 | }
266 |
--------------------------------------------------------------------------------
/arduino_lib/examples/comprehensive/bluetooth_wifi_control/debug.cpp:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
3 | #include"stdio.h"
4 | #include"stdlib.h"
5 |
6 | void arduino_printf(char *fmt ,...)
7 | {
8 | va_list v_arg;
9 | char string[128];
10 | va_start(v_arg,fmt);
11 | vsprintf(string,fmt,v_arg);
12 | Serial.print(string);
13 | }
14 |
--------------------------------------------------------------------------------
/arduino_lib/examples/comprehensive/bluetooth_wifi_control/debug.h:
--------------------------------------------------------------------------------
1 | #ifndef _DEBUG_H_
2 | #define _DEUBG_H_
3 |
4 | #ifndef DEBUG_LEVEL
5 | #define DEBUG_LEVEL 0xFF
6 | #endif
7 |
8 | void arduino_printf(char *fmt ,...);
9 |
10 | #define DEBUG_LEVEL_INFO 0x0001
11 | #define DEBUG_LEVEL_WRN 0x0002
12 | #define DEBUG_LEVEL_ERR 0x0003
13 | #define DEBUG_LEVEL_RED 0x0004
14 | #define DEBUG_LEVEL_ALL 0x0000
15 |
16 | #define DEBUG_LOG(level, fmt, ...) \
17 | do{\
18 | if(level >= DEBUG_LEVEL ){\
19 | arduino_printf(fmt, ##__VA_ARGS__);}\
20 | }while(0)
21 |
22 | #define DEBUG_ERR(fmt, ...) \
23 | do{\
24 | arduino_printf("[Error][%s:%s:%d]",__FILE__,__FUNCTION__,__LINE__);\
25 | arduino_printf(fmt, ##__VA_ARGS__);\
26 | }while(0)
27 |
28 | #define DEBUG_RED(flag, fmt, ...) \
29 | do{\
30 | if(DEBUG_LEVEL & DEBUG_LEVEL_RED){\
31 | arduino_printf("[[30\33m");\
32 | arduino_printf(fmt,##__VA_ARGS__);}\
33 | arduino_printf("\033[0m");\
34 | }while(0)
35 |
36 | #endif /* _DEBUG_ */
37 |
--------------------------------------------------------------------------------
/arduino_lib/examples/comprehensive/ps2_control_4wd/PS2X_lib.h:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * Super amazing PS2 controller Arduino Library v1.8
3 | * details and example sketch:
4 | * http://www.billporter.info/?p=240
5 | *
6 | * Original code by Shutter on Arduino Forums
7 | *
8 | * Revamped, made into lib by and supporting continued development:
9 | * Bill Porter
10 | * www.billporter.info
11 | *
12 | * Contributers:
13 | * Eric Wetzel (thewetzel@gmail.com)
14 | * Kurt Eckhardt
15 | *
16 | * Lib version history
17 | * 0.1 made into library, added analog stick support.
18 | * 0.2 fixed config_gamepad miss-spelling
19 | * added new functions:
20 | * NewButtonState();
21 | * NewButtonState(unsigned int);
22 | * ButtonPressed(unsigned int);
23 | * ButtonReleased(unsigned int);
24 | * removed 'PS' from begining of ever function
25 | * 1.0 found and fixed bug that wasn't configuring controller
26 | * added ability to define pins
27 | * added time checking to reconfigure controller if not polled enough
28 | * Analog sticks and pressures all through 'ps2x.Analog()' function
29 | * added:
30 | * enableRumble();
31 | * enablePressures();
32 | * 1.1
33 | * added some debug stuff for end user. Reports if no controller found
34 | * added auto-increasing sentence delay to see if it helps compatibility.
35 | * 1.2
36 | * found bad math by Shutter for original clock. Was running at 50kHz, not the required 500kHz.
37 | * fixed some of the debug reporting.
38 | * 1.3
39 | * Changed clock back to 50kHz. CuriousInventor says it's suppose to be 500kHz, but doesn't seem to work for everybody.
40 | * 1.4
41 | * Removed redundant functions.
42 | * Fixed mode check to include two other possible modes the controller could be in.
43 | * Added debug code enabled by compiler directives. See below to enable debug mode.
44 | * Added button definitions for shapes as well as colors.
45 | * 1.41
46 | * Some simple bug fixes
47 | * Added Keywords.txt file
48 | * 1.5
49 | * Added proper Guitar Hero compatibility
50 | * Fixed issue with DEBUG mode, had to send serial at once instead of in bits
51 | * 1.6
52 | * Changed config_gamepad() call to include rumble and pressures options
53 | * This was to fix controllers that will only go into config mode once
54 | * Old methods should still work for backwards compatibility
55 | * 1.7
56 | * Integrated Kurt's fixes for the interrupts messing with servo signals
57 | * Reorganized directory so examples show up in Arduino IDE menu
58 | * 1.8
59 | * Added Arduino 1.0 compatibility.
60 | * 1.9
61 | * Kurt - Added detection and recovery from dropping from analog mode, plus
62 | * integreated Chipkit (pic32mx...) support
63 | *
64 | *
65 | *
66 | *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version.
67 | This program is distributed in the hope that it will be useful,
68 | but WITHOUT ANY WARRANTY; without even the implied warranty of
69 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70 | GNU General Public License for more details.
71 |
72 | *
73 | ******************************************************************/
74 |
75 | // $$$$$$$$$$$$ DEBUG ENABLE SECTION $$$$$$$$$$$$$$$$
76 | // to debug ps2 controller, uncomment these two lines to print out debug to uart
77 | //#define PS2X_DEBUG
78 | //#define PS2X_COM_DEBUG
79 |
80 | #ifndef PS2X_lib_h
81 | #define PS2X_lib_h
82 |
83 | #if ARDUINO > 22
84 | #include "Arduino.h"
85 | #else
86 | #include "WProgram.h"
87 | #endif
88 |
89 | #include
90 | #include
91 | #include
92 | #ifdef __AVR__
93 | // AVR
94 | #include
95 | #define CTRL_CLK 4
96 | #define CTRL_BYTE_DELAY 3
97 | #else
98 | // Pic32...
99 | #include
100 | #define CTRL_CLK 5
101 | #define CTRL_CLK_HIGH 5
102 | #define CTRL_BYTE_DELAY 4
103 | #endif
104 |
105 | //These are our button constants
106 | #define PSB_SELECT 0x0001
107 | #define PSB_L3 0x0002
108 | #define PSB_R3 0x0004
109 | #define PSB_START 0x0008
110 | #define PSB_PAD_UP 0x0010
111 | #define PSB_PAD_RIGHT 0x0020
112 | #define PSB_PAD_DOWN 0x0040
113 | #define PSB_PAD_LEFT 0x0080
114 | #define PSB_L2 0x0100
115 | #define PSB_R2 0x0200
116 | #define PSB_L1 0x0400
117 | #define PSB_R1 0x0800
118 | #define PSB_GREEN 0x1000
119 | #define PSB_RED 0x2000
120 | #define PSB_BLUE 0x4000
121 | #define PSB_PINK 0x8000
122 | #define PSB_TRIANGLE 0x1000
123 | #define PSB_CIRCLE 0x2000
124 | #define PSB_CROSS 0x4000
125 | #define PSB_SQUARE 0x8000
126 |
127 | //Guitar button constants
128 | #define UP_STRUM 0x0010
129 | #define DOWN_STRUM 0x0040
130 | #define STAR_POWER 0x0100
131 | #define GREEN_FRET 0x0200
132 | #define YELLOW_FRET 0x1000
133 | #define RED_FRET 0x2000
134 | #define BLUE_FRET 0x4000
135 | #define ORANGE_FRET 0x8000
136 | #define WHAMMY_BAR 8
137 |
138 | //These are stick values
139 | #define PSS_RX 5
140 | #define PSS_RY 6
141 | #define PSS_LX 7
142 | #define PSS_LY 8
143 |
144 | //These are analog buttons
145 | #define PSAB_PAD_RIGHT 9
146 | #define PSAB_PAD_UP 11
147 | #define PSAB_PAD_DOWN 12
148 | #define PSAB_PAD_LEFT 10
149 | #define PSAB_L2 19
150 | #define PSAB_R2 20
151 | #define PSAB_L1 17
152 | #define PSAB_R1 18
153 | #define PSAB_GREEN 13
154 | #define PSAB_RED 14
155 | #define PSAB_BLUE 15
156 | #define PSAB_PINK 16
157 | #define PSAB_TRIANGLE 13
158 | #define PSAB_CIRCLE 14
159 | #define PSAB_CROSS 15
160 | #define PSAB_SQUARE 16
161 |
162 | #define SET(x,y) (x|=(1< 20)
25 | {
26 | ps2x.reconfig_gamepad();
27 | count = 0;
28 | }
29 | ps2x.read_gamepad();
30 | }
31 |
32 | void MotorInit(int leftward, int rightfoward, int leftbackward, int rightbackward)
33 | {
34 | LeftFoward = mMotor.getMotor(leftward);
35 | RightFoward = mMotor.getMotor(rightfoward);
36 | LeftBackward = mMotor.getMotor(leftbackward);
37 | RightBackward = mMotor.getMotor(rightbackward);
38 | delay(200);
39 | mMotor.begin(50);
40 | }
41 |
42 | void SetSpeed(int8_t s)
43 | {
44 | if (s > 100) {
45 | Speed = 100;
46 | return;
47 | } else if (s < 0) {
48 | Speed = 0;
49 | return;
50 | }
51 | Speed = s;
52 | }
53 |
54 | int GetSpeed(void)
55 | {
56 | return Speed;
57 | }
58 |
59 | void SpeedUp(int8_t Duration)
60 | {
61 | SetSpeed(Speed + Duration);
62 | }
63 |
64 | void SpeedDown(int8_t Duration )
65 | {
66 | SetSpeed(Speed - Duration);
67 | }
68 |
69 | void DriveSpeed(int s)
70 | {
71 | if (s >= 0 && s <= 100) {
72 | LeftFoward->setSpeed((s / 10) * 25.5);
73 | RightFoward->setSpeed((s / 10) * 25.5);
74 | LeftBackward->setSpeed((s / 10) * 25.5);
75 | RightBackward->setSpeed((s / 10) * 25.5);
76 | }
77 | }
78 |
79 | void GoForward(void)
80 | {
81 | DriveSpeed(Speed);
82 | LeftFoward->run(FORWARD);
83 | RightFoward->run(FORWARD);
84 | LeftBackward->run(BACKWARD);
85 | RightBackward->run(BACKWARD);
86 | }
87 |
88 | void GoBack(void)
89 | {
90 | DriveSpeed(Speed);
91 | LeftFoward->run(BACKWARD);
92 | RightFoward->run(BACKWARD);
93 | LeftBackward->run(FORWARD);
94 | RightBackward->run(FORWARD);
95 | }
96 | void KeepStop(void)
97 | {
98 | DriveSpeed(0);
99 | LeftFoward->run(BRAKE);
100 | RightFoward->run(BRAKE);
101 | LeftBackward->run(BRAKE);
102 | RightBackward->run(BRAKE);
103 | }
104 |
105 | void TurnLeft(void)
106 | {
107 | int s;
108 | s = (Speed / 10) * 25.5;
109 | LeftFoward->setSpeed(s/2);
110 | LeftBackward->setSpeed(s/2);
111 | RightFoward->setSpeed(s);
112 | RightBackward->setSpeed(s);
113 | LeftFoward->run(FORWARD);
114 | RightFoward->run(FORWARD);
115 | LeftBackward->run(FORWARD);
116 | RightBackward->run(FORWARD);
117 | }
118 |
119 | void TurnRight(void)
120 | {
121 | int s;
122 | s = (Speed / 10) * 25.5;
123 | LeftFoward->setSpeed(s);
124 | LeftBackward->setSpeed(s);
125 | RightFoward->setSpeed(s/2);
126 | RightBackward->setSpeed(s/2);
127 | LeftFoward->run(FORWARD);
128 | RightFoward->run(FORWARD);
129 | LeftBackward->run(FORWARD);
130 | RightBackward->run(FORWARD);
131 | }
132 |
133 | void TurnLeftRotate(void)
134 | {
135 | DriveSpeed(Speed);
136 | LeftFoward->run(BACKWARD);
137 | LeftBackward->run(BACKWARD);
138 | RightFoward->run(FORWARD);
139 | RightBackward->run(FORWARD);
140 | }
141 |
142 | void TurnRightRotate(void)
143 | {
144 | DriveSpeed(Speed);
145 | LeftFoward->run(FORWARD);
146 | LeftBackward->run(FORWARD);
147 | RightFoward->run(BACKWARD);
148 | RightBackward->run(BACKWARD);
149 | }
150 |
151 | void setup()
152 | {
153 | Serial.begin(9600);
154 | MotorInit(M2, M1, M4, M3);
155 | //setup pins and settings: GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
156 | ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT, pressures, rumble);
157 | pinMode(A0, OUTPUT);
158 | tone(A0,131);
159 | delay(200);
160 | noTone(A0);
161 | // MsTimer2::set(50, Ps2Scan);
162 | // MsTimer2::start();
163 | }
164 |
165 | void loop()
166 | {
167 | ps2x.read_gamepad(false, 0);
168 | if (ps2x.ButtonDataByte()) {
169 | if (ps2x.Button(PSB_TRIANGLE)) {
170 | Serial.print("PS2X PSB_TRIANGLE:");
171 | SpeedUp(5);
172 | Serial.println(GetSpeed());
173 | return;
174 | }
175 | if (ps2x.Button(PSB_CROSS)) {
176 | Serial.print("PS2X PSB_CROSS:");
177 | SpeedDown(5);
178 | Serial.println(GetSpeed());
179 | return;
180 | }
181 | if (ps2x.Button(PSB_PAD_UP)) {
182 | Serial.println("PS2X PSB_PAD_UP:");
183 | GoForward();
184 | }
185 | if (ps2x.Button(PSB_PAD_DOWN)) {
186 | Serial.println("PS2X PSB_PAD_DOWN:");
187 | GoBack();
188 | }
189 | if (ps2x.Button(PSB_PAD_LEFT)) {
190 | Serial.println("PS2X PSB_PAD_LEFT:");
191 | TurnLeft();
192 | }
193 | if (ps2x.Button(PSB_PAD_RIGHT)) {
194 | Serial.println("PS2X PSB_PAD_RIGHT:");
195 | TurnRight();
196 | }
197 | if (ps2x.Button(PSB_SQUARE)) {
198 | Serial.println("PS2X PSB_SQUARE:");
199 | TurnLeftRotate();
200 | }
201 | if (ps2x.Button(PSB_CIRCLE)) {
202 | Serial.println("PS2X PSB_CIRCLE:");
203 | TurnRightRotate();
204 | }
205 | } else {
206 | KeepStop();
207 | }
208 | }
209 |
--------------------------------------------------------------------------------
/arduino_lib/examples/comprehensive/ps2_control_4wd_with_robotic_arm/PS2X_lib.h:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * Super amazing PS2 controller Arduino Library v1.8
3 | * details and example sketch:
4 | * http://www.billporter.info/?p=240
5 | *
6 | * Original code by Shutter on Arduino Forums
7 | *
8 | * Revamped, made into lib by and supporting continued development:
9 | * Bill Porter
10 | * www.billporter.info
11 | *
12 | * Contributers:
13 | * Eric Wetzel (thewetzel@gmail.com)
14 | * Kurt Eckhardt
15 | *
16 | * Lib version history
17 | * 0.1 made into library, added analog stick support.
18 | * 0.2 fixed config_gamepad miss-spelling
19 | * added new functions:
20 | * NewButtonState();
21 | * NewButtonState(unsigned int);
22 | * ButtonPressed(unsigned int);
23 | * ButtonReleased(unsigned int);
24 | * removed 'PS' from begining of ever function
25 | * 1.0 found and fixed bug that wasn't configuring controller
26 | * added ability to define pins
27 | * added time checking to reconfigure controller if not polled enough
28 | * Analog sticks and pressures all through 'ps2x.Analog()' function
29 | * added:
30 | * enableRumble();
31 | * enablePressures();
32 | * 1.1
33 | * added some debug stuff for end user. Reports if no controller found
34 | * added auto-increasing sentence delay to see if it helps compatibility.
35 | * 1.2
36 | * found bad math by Shutter for original clock. Was running at 50kHz, not the required 500kHz.
37 | * fixed some of the debug reporting.
38 | * 1.3
39 | * Changed clock back to 50kHz. CuriousInventor says it's suppose to be 500kHz, but doesn't seem to work for everybody.
40 | * 1.4
41 | * Removed redundant functions.
42 | * Fixed mode check to include two other possible modes the controller could be in.
43 | * Added debug code enabled by compiler directives. See below to enable debug mode.
44 | * Added button definitions for shapes as well as colors.
45 | * 1.41
46 | * Some simple bug fixes
47 | * Added Keywords.txt file
48 | * 1.5
49 | * Added proper Guitar Hero compatibility
50 | * Fixed issue with DEBUG mode, had to send serial at once instead of in bits
51 | * 1.6
52 | * Changed config_gamepad() call to include rumble and pressures options
53 | * This was to fix controllers that will only go into config mode once
54 | * Old methods should still work for backwards compatibility
55 | * 1.7
56 | * Integrated Kurt's fixes for the interrupts messing with servo signals
57 | * Reorganized directory so examples show up in Arduino IDE menu
58 | * 1.8
59 | * Added Arduino 1.0 compatibility.
60 | * 1.9
61 | * Kurt - Added detection and recovery from dropping from analog mode, plus
62 | * integreated Chipkit (pic32mx...) support
63 | *
64 | *
65 | *
66 | *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version.
67 | This program is distributed in the hope that it will be useful,
68 | but WITHOUT ANY WARRANTY; without even the implied warranty of
69 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70 | GNU General Public License for more details.
71 |
72 | *
73 | ******************************************************************/
74 |
75 | // $$$$$$$$$$$$ DEBUG ENABLE SECTION $$$$$$$$$$$$$$$$
76 | // to debug ps2 controller, uncomment these two lines to print out debug to uart
77 | //#define PS2X_DEBUG
78 | //#define PS2X_COM_DEBUG
79 |
80 | #ifndef PS2X_lib_h
81 | #define PS2X_lib_h
82 |
83 | #if ARDUINO > 22
84 | #include "Arduino.h"
85 | #else
86 | #include "WProgram.h"
87 | #endif
88 |
89 | #include
90 | #include
91 | #include
92 | #ifdef __AVR__
93 | // AVR
94 | #include
95 | #define CTRL_CLK 4
96 | #define CTRL_BYTE_DELAY 3
97 | #else
98 | // Pic32...
99 | #include
100 | #define CTRL_CLK 5
101 | #define CTRL_CLK_HIGH 5
102 | #define CTRL_BYTE_DELAY 4
103 | #endif
104 |
105 | //These are our button constants
106 | #define PSB_SELECT 0x0001
107 | #define PSB_L3 0x0002
108 | #define PSB_R3 0x0004
109 | #define PSB_START 0x0008
110 | #define PSB_PAD_UP 0x0010
111 | #define PSB_PAD_RIGHT 0x0020
112 | #define PSB_PAD_DOWN 0x0040
113 | #define PSB_PAD_LEFT 0x0080
114 | #define PSB_L2 0x0100
115 | #define PSB_R2 0x0200
116 | #define PSB_L1 0x0400
117 | #define PSB_R1 0x0800
118 | #define PSB_GREEN 0x1000
119 | #define PSB_RED 0x2000
120 | #define PSB_BLUE 0x4000
121 | #define PSB_PINK 0x8000
122 | #define PSB_TRIANGLE 0x1000
123 | #define PSB_CIRCLE 0x2000
124 | #define PSB_CROSS 0x4000
125 | #define PSB_SQUARE 0x8000
126 |
127 | //Guitar button constants
128 | #define UP_STRUM 0x0010
129 | #define DOWN_STRUM 0x0040
130 | #define STAR_POWER 0x0100
131 | #define GREEN_FRET 0x0200
132 | #define YELLOW_FRET 0x1000
133 | #define RED_FRET 0x2000
134 | #define BLUE_FRET 0x4000
135 | #define ORANGE_FRET 0x8000
136 | #define WHAMMY_BAR 8
137 |
138 | //These are stick values
139 | #define PSS_RX 5
140 | #define PSS_RY 6
141 | #define PSS_LX 7
142 | #define PSS_LY 8
143 |
144 | //These are analog buttons
145 | #define PSAB_PAD_RIGHT 9
146 | #define PSAB_PAD_UP 11
147 | #define PSAB_PAD_DOWN 12
148 | #define PSAB_PAD_LEFT 10
149 | #define PSAB_L2 19
150 | #define PSAB_R2 20
151 | #define PSAB_L1 17
152 | #define PSAB_R1 18
153 | #define PSAB_GREEN 13
154 | #define PSAB_RED 14
155 | #define PSAB_BLUE 15
156 | #define PSAB_PINK 16
157 | #define PSAB_TRIANGLE 13
158 | #define PSAB_CIRCLE 14
159 | #define PSAB_CROSS 15
160 | #define PSAB_SQUARE 16
161 |
162 | #define SET(x,y) (x|=(1< 100) {
46 | Speed = 100;
47 | return;
48 | } else if (s < 0) {
49 | Speed = 0;
50 | return;
51 | }
52 | Speed = s;
53 | }
54 |
55 | int GetSpeed(void)
56 | {
57 | return Speed;
58 | }
59 |
60 | void SpeedUp(int8_t Duration)
61 | {
62 | SetSpeed(Speed + Duration);
63 | }
64 |
65 | void SpeedDown(int8_t Duration )
66 | {
67 | SetSpeed(Speed - Duration);
68 | }
69 |
70 | void DriveSpeed(int s)
71 | {
72 | if (s >= 0 && s <= 100) {
73 | LeftFoward->setSpeed((s / 10) * 25.5);
74 | RightFoward->setSpeed((s / 10) * 25.5);
75 | LeftBackward->setSpeed((s / 10) * 25.5);
76 | RightBackward->setSpeed((s / 10) * 25.5);
77 | }
78 | }
79 |
80 | void GoForward(void)
81 | {
82 | DriveSpeed(Speed);
83 | LeftFoward->run(FORWARD);
84 | RightFoward->run(FORWARD);
85 | LeftBackward->run(FORWARD);
86 | RightBackward->run(FORWARD);
87 | }
88 |
89 | void GoBack(void)
90 | {
91 | DriveSpeed(Speed);
92 | LeftFoward->run(BACKWARD);
93 | RightFoward->run(BACKWARD);
94 | LeftBackward->run(BACKWARD);
95 | RightBackward->run(BACKWARD);
96 | }
97 | void KeepStop(void)
98 | {
99 | DriveSpeed(0);
100 | LeftFoward->run(BRAKE);
101 | RightFoward->run(BRAKE);
102 | LeftBackward->run(BRAKE);
103 | RightBackward->run(BRAKE);
104 | }
105 |
106 | void TurnLeft(void)
107 | {
108 | int s;
109 | s = (Speed / 10) * 25.5;
110 | LeftFoward->setSpeed(s/2);
111 | LeftBackward->setSpeed(s/2);
112 | RightFoward->setSpeed(s);
113 | RightBackward->setSpeed(s);
114 | LeftFoward->run(FORWARD);
115 | RightFoward->run(FORWARD);
116 | LeftBackward->run(FORWARD);
117 | RightBackward->run(FORWARD);
118 | }
119 |
120 | void TurnRight(void)
121 | {
122 | int s;
123 | s = (Speed / 10) * 25.5;
124 | LeftFoward->setSpeed(s);
125 | LeftBackward->setSpeed(s);
126 | RightFoward->setSpeed(s/2);
127 | RightBackward->setSpeed(s/2);
128 | LeftFoward->run(FORWARD);
129 | RightFoward->run(FORWARD);
130 | LeftBackward->run(FORWARD);
131 | RightBackward->run(FORWARD);
132 | }
133 |
134 | void TurnLeftRotate(void)
135 | {
136 | DriveSpeed(Speed);
137 | LeftFoward->run(BACKWARD);
138 | LeftBackward->run(BACKWARD);
139 | RightFoward->run(FORWARD);
140 | RightBackward->run(FORWARD);
141 | }
142 |
143 | void TurnRightRotate(void)
144 | {
145 | DriveSpeed(Speed);
146 | LeftFoward->run(FORWARD);
147 | LeftBackward->run(FORWARD);
148 | RightFoward->run(BACKWARD);
149 | RightBackward->run(BACKWARD);
150 | }
151 |
152 | void InitServo(void)
153 | {
154 | mServo1 = mMotorDriver.getServo(1);
155 | mServo2 = mMotorDriver.getServo(2);
156 | mServo3 = mMotorDriver.getServo(3);
157 | mServo4 = mMotorDriver.getServo(4);
158 | mServo5 = mMotorDriver.getServo(5);
159 | mServo6 = mMotorDriver.getServo(6);
160 | }
161 |
162 | void SetServoBaseDegree(uint8_t base)
163 | {
164 | ServoBaseDegree = base;
165 | }
166 |
167 | void SetServoDegree(byte pin , byte Angle)
168 | {
169 | int Degree = Angle;
170 | int servo_degree;
171 | ServoPin = pin;
172 | if (Degree > 360) {
173 | return;
174 | }
175 | if (Degree == 90 || Degree == 270) {
176 | servo_degree = ServoBaseDegree;
177 | } else if (Degree >= 0 && Degree <= 180) {
178 | servo_degree = ServoBaseDegree - 90 + Degree; // 180-degree-diff
179 | }
180 | if (ServoPin == 1)
181 | mServo1->writeServo(servo_degree);
182 | else if (ServoPin == 2)
183 | mServo2->writeServo(Angle);
184 | else if (ServoPin == 3)
185 | mServo3->writeServo(Angle);
186 | else if (ServoPin == 4)
187 | mServo4->writeServo(Angle);
188 | else if (ServoPin == 5)
189 | mServo5->writeServo(Angle);
190 | else if (ServoPin == 6)
191 | mServo6->writeServo(Angle);
192 | }
193 |
194 | uint16_t LeftHart(void)
195 | {
196 | LY = float((ps2x.Analog(PSS_LY)) - 127) / 127;
197 | LX = float((ps2x.Analog(PSS_LX)) - 127) / 127;
198 | if ((-0.1 <= LX) && (LX <= 0.1) && (-0.1 <= LY) && (LY <= 0.1)) {
199 | return 0xFFF;
200 | } else {
201 | if ((LX > 0) && (LY > 0)) {
202 | LeftAngle = 360 - (atan(LY / LX) * 58);
203 | } else if ((LX < 0) && (LY > 0)) {
204 | LeftAngle = 180 + (abs(atan(LY / LX) * 58));
205 | } else if ((LX < 0) && (LY < 0)) {
206 | LeftAngle = 180 - (abs(atan(LY / LX) * 58)) ;
207 | } else if ((LX > 0) && (LY < 0)) {
208 | LeftAngle = abs(atan(LY / LX) * 58);
209 | }
210 | return LeftAngle;
211 | }
212 | }
213 | uint16_t RightHart(void)
214 | {
215 | RY = float((ps2x.Analog(PSS_RY)) - 127) / 127;
216 | RX = float((ps2x.Analog(PSS_RX)) - 127) / 127;
217 | if ((-0.1 <= RX) && (RX <= 0.1) && (-0.1 <= RY) && (RY <= 0.1)) {
218 | return 0xFFF;
219 | } else {
220 | if ((RX > 0) && (RY > 0)) {
221 | RightAngle = 360 - (atan(RY / RX) * 58);
222 | } else if ((RX < 0) && (RY > 0)) {
223 | RightAngle = 180 + (abs(atan(RY / RX) * 58));
224 | } else if ((RX < 0) && (RY < 0)) {
225 | RightAngle = 180 - (abs(atan(RY / RX) * 58)) ;
226 | } else if ((RX > 0) && (RY < 0)) {
227 | RightAngle = abs(atan(RY / RX) * 58);
228 | }
229 | return RightAngle;
230 | }
231 | }
232 |
233 | void setup()
234 | {
235 | Serial.begin(9600);
236 | mMotorDriver.begin(50);
237 | InitServo();
238 | moto_init(M2, M1, M4, M3);
239 | ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT, pressures, rumble);
240 | SetServoBaseDegree(90);
241 | SetServoDegree(1, 90);
242 | }
243 |
244 | void HandlePS2(void)
245 | {
246 | int Ps2xRightAngle, Ps2xLeftAngle;
247 | //ps2x.read_gamepad(false, 0);
248 | if (ps2x.ButtonDataByte()) {
249 | if (ps2x.Button(PSB_TRIANGLE)) {
250 | Serial.print("PS2X PSB_TRIANGLE:");
251 | SpeedUp(5);
252 | Serial.println(GetSpeed());
253 | return;
254 | }
255 | if (ps2x.Button(PSB_CROSS)) {
256 | Serial.print("PS2X PSB_CROSS:");
257 | SpeedDown(5);
258 | Serial.println(GetSpeed());
259 | return;
260 | }
261 | if (ps2x.Button(PSB_PAD_UP)) {
262 | Serial.println("PS2X PSB_PAD_UP:");
263 | GoForward();
264 | }
265 | if (ps2x.Button(PSB_PAD_DOWN)) {
266 | Serial.println("PS2X PSB_PAD_DOWN:");
267 | GoBack();
268 | }
269 | if (ps2x.Button(PSB_PAD_LEFT)) {
270 | Serial.println("PS2X PSB_PAD_LEFT:");
271 | TurnLeft();
272 | }
273 | if (ps2x.Button(PSB_PAD_RIGHT)) {
274 | Serial.println("PS2X PSB_PAD_RIGHT:");
275 | TurnRight();
276 | }
277 | if (ps2x.Button(PSB_SQUARE)) {
278 | Serial.println("PS2X PSB_SQUARE:");
279 | TurnLeftRotate();
280 | }
281 | if (ps2x.Button(PSB_CIRCLE)) {
282 | Serial.println("PS2X PSB_CIRCLE:");
283 | TurnRightRotate();
284 | }
285 | if (ps2x.Button(PSB_L1)) {
286 | if (UpServo < 140)
287 | UpServo += 4;
288 | }
289 | if (ps2x.Button(PSB_R1)) {
290 | if (UpServo > 47)
291 | UpServo -= 4;
292 | }
293 | } else {
294 | KeepStop();
295 | Ps2xRightAngle = RightHart();
296 | Ps2xLeftAngle = LeftHart();
297 | if ((Ps2xRightAngle != 0xFFF) || (Ps2xLeftAngle != 0xFFF)) {
298 | if ((90 < Ps2xLeftAngle) && (Ps2xLeftAngle <= 270))
299 | {
300 | if (DownServo < 180) {
301 | DownServo += 2;
302 | }
303 | } else if ((270 < Ps2xLeftAngle) && (Ps2xLeftAngle <= 360) || (0 <= Ps2xLeftAngle) && (Ps2xLeftAngle <= 90)) {
304 | if (DownServo != 0) {
305 | DownServo -= 2;
306 | }
307 | }
308 | if ((45 <= Ps2xRightAngle) && (Ps2xRightAngle < 135)) {
309 | if ((RightServo < 175)) {
310 | RightServo += 2;
311 | }
312 | } else if ((225 <= Ps2xRightAngle) && (Ps2xRightAngle < 315)) {
313 | if (((RightServo != 0) && (100 < LeftServo)) && (RightServo > 70)) {
314 | RightServo -= 2;
315 | }
316 | } else if ((135 <= Ps2xRightAngle) && (Ps2xRightAngle < 225)) {
317 | if (LeftServo < 160) {
318 | LeftServo += 2;
319 | }
320 | } else if ((315 <= Ps2xRightAngle) && (Ps2xRightAngle <= 360) || (0 <= Ps2xRightAngle) && (Ps2xRightAngle < 45)) {
321 | if (LeftServo >= 92) {
322 | LeftServo -= 2;
323 | }
324 | }
325 | SetServoDegree(1, DownServo);
326 | SetServoDegree(2, LeftServo);
327 | SetServoDegree(3, RightServo);
328 | }
329 | }
330 | SetServoDegree(4, UpServo);
331 | delay(50);
332 | }
333 |
334 | void loop()
335 | {
336 | HandlePS2();
337 | }
338 |
--------------------------------------------------------------------------------
/arduino_lib/examples/comprehensive/ps2_control_mecanum_wheel_car/PS2X_lib.h:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * Super amazing PS2 controller Arduino Library v1.8
3 | * details and example sketch:
4 | * http://www.billporter.info/?p=240
5 | *
6 | * Original code by Shutter on Arduino Forums
7 | *
8 | * Revamped, made into lib by and supporting continued development:
9 | * Bill Porter
10 | * www.billporter.info
11 | *
12 | * Contributers:
13 | * Eric Wetzel (thewetzel@gmail.com)
14 | * Kurt Eckhardt
15 | *
16 | * Lib version history
17 | * 0.1 made into library, added analog stick support.
18 | * 0.2 fixed config_gamepad miss-spelling
19 | * added new functions:
20 | * NewButtonState();
21 | * NewButtonState(unsigned int);
22 | * ButtonPressed(unsigned int);
23 | * ButtonReleased(unsigned int);
24 | * removed 'PS' from begining of ever function
25 | * 1.0 found and fixed bug that wasn't configuring controller
26 | * added ability to define pins
27 | * added time checking to reconfigure controller if not polled enough
28 | * Analog sticks and pressures all through 'ps2x.Analog()' function
29 | * added:
30 | * enableRumble();
31 | * enablePressures();
32 | * 1.1
33 | * added some debug stuff for end user. Reports if no controller found
34 | * added auto-increasing sentence delay to see if it helps compatibility.
35 | * 1.2
36 | * found bad math by Shutter for original clock. Was running at 50kHz, not the required 500kHz.
37 | * fixed some of the debug reporting.
38 | * 1.3
39 | * Changed clock back to 50kHz. CuriousInventor says it's suppose to be 500kHz, but doesn't seem to work for everybody.
40 | * 1.4
41 | * Removed redundant functions.
42 | * Fixed mode check to include two other possible modes the controller could be in.
43 | * Added debug code enabled by compiler directives. See below to enable debug mode.
44 | * Added button definitions for shapes as well as colors.
45 | * 1.41
46 | * Some simple bug fixes
47 | * Added Keywords.txt file
48 | * 1.5
49 | * Added proper Guitar Hero compatibility
50 | * Fixed issue with DEBUG mode, had to send serial at once instead of in bits
51 | * 1.6
52 | * Changed config_gamepad() call to include rumble and pressures options
53 | * This was to fix controllers that will only go into config mode once
54 | * Old methods should still work for backwards compatibility
55 | * 1.7
56 | * Integrated Kurt's fixes for the interrupts messing with servo signals
57 | * Reorganized directory so examples show up in Arduino IDE menu
58 | * 1.8
59 | * Added Arduino 1.0 compatibility.
60 | * 1.9
61 | * Kurt - Added detection and recovery from dropping from analog mode, plus
62 | * integreated Chipkit (pic32mx...) support
63 | *
64 | *
65 | *
66 | *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version.
67 | This program is distributed in the hope that it will be useful,
68 | but WITHOUT ANY WARRANTY; without even the implied warranty of
69 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70 | GNU General Public License for more details.
71 |
72 | *
73 | ******************************************************************/
74 |
75 | // $$$$$$$$$$$$ DEBUG ENABLE SECTION $$$$$$$$$$$$$$$$
76 | // to debug ps2 controller, uncomment these two lines to print out debug to uart
77 | //#define PS2X_DEBUG
78 | //#define PS2X_COM_DEBUG
79 |
80 | #ifndef PS2X_lib_h
81 | #define PS2X_lib_h
82 |
83 | #if ARDUINO > 22
84 | #include "Arduino.h"
85 | #else
86 | #include "WProgram.h"
87 | #endif
88 |
89 | #include
90 | #include
91 | #include
92 | #ifdef __AVR__
93 | // AVR
94 | #include
95 | #define CTRL_CLK 4
96 | #define CTRL_BYTE_DELAY 3
97 | #else
98 | // Pic32...
99 | #include
100 | #define CTRL_CLK 5
101 | #define CTRL_CLK_HIGH 5
102 | #define CTRL_BYTE_DELAY 4
103 | #endif
104 |
105 | //These are our button constants
106 | #define PSB_SELECT 0x0001
107 | #define PSB_L3 0x0002
108 | #define PSB_R3 0x0004
109 | #define PSB_START 0x0008
110 | #define PSB_PAD_UP 0x0010
111 | #define PSB_PAD_RIGHT 0x0020
112 | #define PSB_PAD_DOWN 0x0040
113 | #define PSB_PAD_LEFT 0x0080
114 | #define PSB_L2 0x0100
115 | #define PSB_R2 0x0200
116 | #define PSB_L1 0x0400
117 | #define PSB_R1 0x0800
118 | #define PSB_GREEN 0x1000
119 | #define PSB_RED 0x2000
120 | #define PSB_BLUE 0x4000
121 | #define PSB_PINK 0x8000
122 | #define PSB_TRIANGLE 0x1000
123 | #define PSB_CIRCLE 0x2000
124 | #define PSB_CROSS 0x4000
125 | #define PSB_SQUARE 0x8000
126 |
127 | //Guitar button constants
128 | #define UP_STRUM 0x0010
129 | #define DOWN_STRUM 0x0040
130 | #define STAR_POWER 0x0100
131 | #define GREEN_FRET 0x0200
132 | #define YELLOW_FRET 0x1000
133 | #define RED_FRET 0x2000
134 | #define BLUE_FRET 0x4000
135 | #define ORANGE_FRET 0x8000
136 | #define WHAMMY_BAR 8
137 |
138 | //These are stick values
139 | #define PSS_RX 5
140 | #define PSS_RY 6
141 | #define PSS_LX 7
142 | #define PSS_LY 8
143 |
144 | //These are analog buttons
145 | #define PSAB_PAD_RIGHT 9
146 | #define PSAB_PAD_UP 11
147 | #define PSAB_PAD_DOWN 12
148 | #define PSAB_PAD_LEFT 10
149 | #define PSAB_L2 19
150 | #define PSAB_R2 20
151 | #define PSAB_L1 17
152 | #define PSAB_R1 18
153 | #define PSAB_GREEN 13
154 | #define PSAB_RED 14
155 | #define PSAB_BLUE 15
156 | #define PSAB_PINK 16
157 | #define PSAB_TRIANGLE 13
158 | #define PSAB_CIRCLE 14
159 | #define PSAB_CROSS 15
160 | #define PSAB_SQUARE 16
161 |
162 | #define SET(x,y) (x|=(1<setSpeed(speed_val);
44 | DCMotor_1->run(FORWARD);
45 | DCMotor_2->setSpeed(speed_val);
46 | DCMotor_2->run(FORWARD);
47 | DCMotor_3->setSpeed(speed_val);
48 | DCMotor_3->run(FORWARD);
49 | DCMotor_4->setSpeed(speed_val);
50 | DCMotor_4->run(FORWARD);
51 | }
52 | if(ps2x.Button(PSB_PAD_LEFT)){
53 | Serial.print("LEFT held this hard: ");
54 | Serial.println(ps2x.Analog(PSAB_PAD_LEFT), DEC);
55 | //左平移
56 | DCMotor_1->setSpeed(speed_val);
57 | DCMotor_1->run(BACKWARD);
58 | DCMotor_2->setSpeed(speed_val);
59 | DCMotor_2->run(FORWARD);
60 | DCMotor_3->setSpeed(speed_val);
61 | DCMotor_3->run(FORWARD);
62 | DCMotor_4->setSpeed(speed_val);
63 | DCMotor_4->run(BACKWARD);
64 | }
65 | if(ps2x.Button(PSB_PAD_RIGHT)){
66 | Serial.print("Right held this hard: ");
67 | Serial.println(ps2x.Analog(PSAB_PAD_RIGHT), DEC);
68 | //右平移
69 | DCMotor_1->setSpeed(speed_val);
70 | DCMotor_1->run(FORWARD);
71 | DCMotor_2->setSpeed(speed_val);
72 | DCMotor_2->run(BACKWARD);
73 | DCMotor_3->setSpeed(speed_val);
74 | DCMotor_3->run(BACKWARD);
75 | DCMotor_4->setSpeed(speed_val);
76 | DCMotor_4->run(FORWARD);
77 | }
78 | if(ps2x.Button(PSB_PAD_DOWN)){
79 | Serial.print("DOWN held this hard: ");
80 | Serial.println(ps2x.Analog(PSAB_PAD_DOWN), DEC);
81 | //后退
82 | DCMotor_1->setSpeed(speed_val);
83 | DCMotor_1->run(BACKWARD);
84 | DCMotor_2->setSpeed(speed_val);
85 | DCMotor_2->run(BACKWARD);
86 | DCMotor_3->setSpeed(speed_val);
87 | DCMotor_3->run(BACKWARD);
88 | DCMotor_4->setSpeed(speed_val);
89 | DCMotor_4->run(BACKWARD);
90 | }
91 | }else {
92 | DCMotor_1->run(BRAKE);
93 | DCMotor_2->run(BRAKE);
94 | DCMotor_3->run(BRAKE);
95 | DCMotor_4->run(BRAKE);
96 | }
97 | if(ps2x.ButtonPressed(PSB_CIRCLE)){
98 | Serial.println("Circle just pressed");
99 | //原地旋转
100 | //逆时针
101 | DCMotor_1->setSpeed(speed_val);
102 | DCMotor_1->run(FORWARD);
103 | DCMotor_2->setSpeed(speed_val);
104 | DCMotor_2->run(BACKWARD);
105 | DCMotor_3->setSpeed(speed_val);
106 | DCMotor_3->run(FORWARD);
107 | DCMotor_4->setSpeed(speed_val);
108 | DCMotor_4->run(BACKWARD);
109 | //顺时针
110 | // DCMotor_1->setSpeed(speed_val);
111 | // DCMotor_1->run(BACKWARD);
112 | // DCMotor_2->setSpeed(speed_val);
113 | // DCMotor_2->run(FORWARD);
114 | // DCMotor_3->setSpeed(speed_val);
115 | // DCMotor_3->run(BACKWARD);
116 | // DCMotor_4->setSpeed(speed_val);
117 | // DCMotor_4->run(FORWARD);
118 | }
119 | if(ps2x.ButtonPressed(PSB_CROSS)){
120 | Serial.println("X just changed");
121 | // 刹车
122 | DCMotor_1->run(BRAKE);
123 | DCMotor_2->run(BRAKE);
124 | DCMotor_3->run(BRAKE);
125 | DCMotor_4->run(BRAKE);
126 | }
127 | if(ps2x.ButtonPressed(PSB_SQUARE)){
128 | Serial.println("Square just released");
129 | DCMotor_1->setSpeed(speed_val);
130 | DCMotor_1->run(BACKWARD);
131 | DCMotor_2->setSpeed(speed_val);
132 | DCMotor_2->run(FORWARD);
133 | DCMotor_3->setSpeed(speed_val);
134 | DCMotor_3->run(BACKWARD);
135 | DCMotor_4->setSpeed(speed_val);
136 | DCMotor_4->run(FORWARD);
137 | }
138 | if(ps2x.ButtonPressed(PSB_TRIANGLE)){
139 | Serial.println("Triangle pressed");
140 | //右前方45°
141 | DCMotor_1->setSpeed(speed_val);
142 | DCMotor_1->run(FORWARD);
143 | DCMotor_2->run(BRAKE);
144 | DCMotor_3->run(BRAKE);
145 | DCMotor_4->setSpeed(speed_val);
146 | DCMotor_4->run(FORWARD);
147 | //左后方45°
148 | // DCMotor_1->setSpeed(speed_val);
149 | // DCMotor_1->run(BACKWARD);
150 | // DCMotor_2->run(BRAKE);
151 | // DCMotor_3->run(BRAKE);
152 | // DCMotor_4->setSpeed(speed_val);
153 | // DCMotor_4->run(BACKWARD);
154 | //左前方45°
155 | // DCMotor_2->setSpeed(speed_val);
156 | // DCMotor_2->run(FORWARD);
157 | // DCMotor_1->run(BRAKE);
158 | // DCMotor_4->run(BRAKE);
159 | // DCMotor_3->setSpeed(speed_val);
160 | // DCMotor_3->run(FORWARD);
161 | //右后方45°
162 | // DCMotor_2->setSpeed(speed_val);
163 | // DCMotor_2->run(BACKWARD);
164 | // DCMotor_1->run(BRAKE);
165 | // DCMotor_4->run(BRAKE);
166 | // DCMotor_3->setSpeed(speed_val);
167 | // DCMotor_3->run(BACKWARD);
168 | }
169 | }
--------------------------------------------------------------------------------
/arduino_lib/examples/motor_test/dc/dc.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 |
3 | Emakefun_MotorDriver mMotor = Emakefun_MotorDriver(0x60);
4 | Emakefun_DCMotor *DCMotor_1 = mMotor.getMotor(M1);
5 | Emakefun_DCMotor *DCMotor_2 = mMotor.getMotor(M2);
6 | Emakefun_DCMotor *DCMotor_3 = mMotor.getMotor(M3);
7 | Emakefun_DCMotor *DCMotor_4 = mMotor.getMotor(M4);
8 |
9 | void setup()
10 | {
11 | Serial.begin(9600);
12 | mMotor.begin(50);
13 | }
14 |
15 | void loop()
16 | {
17 | // 前进
18 | DCMotor_1->setSpeed(200);
19 | DCMotor_1->run(FORWARD);
20 | DCMotor_2->setSpeed(200);
21 | DCMotor_2->run(FORWARD);
22 | DCMotor_3->setSpeed(200);
23 | DCMotor_3->run(FORWARD);
24 | DCMotor_4->setSpeed(200);
25 | DCMotor_4->run(FORWARD);
26 | delay(4000);
27 | // 后退
28 | DCMotor_1->setSpeed(100);
29 | DCMotor_1->run(BACKWARD);
30 | DCMotor_2->setSpeed(100);
31 | DCMotor_2->run(BACKWARD);
32 | DCMotor_3->setSpeed(100);
33 | DCMotor_3->run(BACKWARD);
34 | DCMotor_4->setSpeed(100);
35 | DCMotor_4->run(BACKWARD);
36 | delay(4000);
37 | // 刹车
38 | DCMotor_1->run(BRAKE);
39 | DCMotor_2->run(BRAKE);
40 | DCMotor_3->run(BRAKE);
41 | DCMotor_4->run(BRAKE);
42 | delay(4000);
43 | }
44 |
--------------------------------------------------------------------------------
/arduino_lib/examples/motor_test/encoder/encoder.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 |
3 | #define ONE_CIRCLE_PULSE 1080 //90*12=1080
4 |
5 | Emakefun_MotorDriver mMotorDriver = Emakefun_MotorDriver();
6 | Emakefun_EncoderMotor *EncodeMotor_1 = mMotorDriver.getEncoderMotor(E1);
7 | Emakefun_EncoderMotor *EncodeMotor_2 = mMotorDriver.getEncoderMotor(E2);
8 | Emakefun_EncoderMotor *EncodeMotor_3 = mMotorDriver.getEncoderMotor(E3);
9 | Emakefun_EncoderMotor *EncodeMotor_4 = mMotorDriver.getEncoderMotor(E4);
10 |
11 | void encoder1(void)
12 | {
13 | if (digitalRead(EncodeMotor_1->ENCODER2pin) == LOW) {
14 | EncodeMotor_1->EncoderPulse++;
15 | } else {
16 | EncodeMotor_1->EncoderPulse--;
17 | }
18 | }
19 |
20 | void encoder2(void)
21 | {
22 | if (digitalRead(EncodeMotor_2->ENCODER2pin) == LOW) {
23 | EncodeMotor_2->EncoderPulse++;
24 | } else {
25 | EncodeMotor_2->EncoderPulse--;
26 | }
27 | }
28 |
29 | void encoder3(void)
30 | {
31 | if (digitalRead(EncodeMotor_3->ENCODER2pin) == LOW) {
32 | EncodeMotor_3->EncoderPulse++;
33 | } else {
34 | EncodeMotor_3->EncoderPulse--;
35 | }
36 | }
37 |
38 | void encoder4(void)
39 | {
40 | if (digitalRead(EncodeMotor_4->ENCODER2pin) == LOW) {
41 | EncodeMotor_4->EncoderPulse++;
42 | } else {
43 | EncodeMotor_4->EncoderPulse--;
44 | }
45 | }
46 |
47 | void setup()
48 | {
49 | Serial.begin(9600);
50 | mMotorDriver.begin();
51 | delay(100);
52 | Serial.println("start");
53 | EncodeMotor_1->init(encoder1);
54 | EncodeMotor_2->init(encoder2);
55 | EncodeMotor_3->init(encoder3);
56 | EncodeMotor_4->init(encoder4);
57 | EncodeMotor_1->setSpeed(200);
58 | EncodeMotor_2->setSpeed(200);
59 | EncodeMotor_3->setSpeed(200);
60 | EncodeMotor_4->setSpeed(200);
61 | EncodeMotor_1->run(FORWARD);
62 | EncodeMotor_2->run(FORWARD);
63 | EncodeMotor_3->run(BACKWARD);
64 | EncodeMotor_4->run(BACKWARD);
65 | EncodeMotor_1->run(BACKWARD, 200, ONE_CIRCLE_PULSE);
66 | while(1);
67 | }
68 |
69 | void loop()
70 | {
71 |
72 | Serial.print("Encoder1Pulse:");
73 | Serial.println(EncodeMotor_1->EncoderPulse);
74 | Serial.print("Encoder2Pulse:");
75 | Serial.println(EncodeMotor_2->EncoderPulse);
76 | Serial.print("Encoder3Pulse:");
77 | Serial.println(EncodeMotor_3->EncoderPulse);
78 | Serial.print("Encoder4Pulse:");
79 | Serial.println(EncodeMotor_4->EncoderPulse);
80 | while(1) {
81 |
82 | if (EncodeMotor_1->EncoderPulse > 180*12) {
83 | // Serial.println("STOP");
84 | EncodeMotor_1->run(BRAKE);
85 | } else {
86 | Serial.println(EncodeMotor_1->EncoderPulse);
87 | }
88 | //delay(10);
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/arduino_lib/examples/motor_test/encoder_pid/encoder_pid.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 | #include "MsTimer2.h"
3 | #include "PID_v1.h"
4 |
5 | double Setpoint, Input, Output;
6 | double Kp=1, Ki=5, Kd=0;
7 | PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);//速度为正值时:DIRECT 负值时:REVERSE
8 |
9 | static volatile int Encoder1Pulse = 0, Encoder2Pulse = 0;
10 | int ratio = 1.5;//电机减速比
11 |
12 | Emakefun_MotorDriver mMotorDriver = Emakefun_MotorDriver();
13 | Emakefun_EncoderMotor *EncodeMotor_1 = mMotorDriver.getEncoderMotor(E1);
14 |
15 | void EncoderSpeed()
16 | {
17 | Input = EncodeMotor_1->EncoderPulse*ratio;
18 | EncodeMotor_1->EncoderPulse = 0;
19 | Serial.println(Input);
20 | }
21 |
22 | static void encoder1(void)
23 | {
24 | if (digitalRead(EncodeMotor_1->ENCODER2pin) == LOW) {
25 | EncodeMotor_1->EncoderPulse++;
26 | } else {
27 | EncodeMotor_1->EncoderPulse--;
28 | }
29 | }
30 |
31 | void setup()
32 | {
33 | Serial.begin(9600);
34 | mMotorDriver.begin();
35 | EncodeMotor_1->init(encoder1);
36 | MsTimer2::set(100, EncoderSpeed); // 500ms period
37 | MsTimer2::start();
38 | Setpoint = 100;
39 | myPID.SetOutputLimits(-255, 255);
40 | myPID.SetSampleTime(100);
41 | myPID.SetMode(AUTOMATIC);
42 |
43 | }
44 |
45 | void loop()
46 | {
47 | myPID.Compute();
48 | EncodeMotor_1->setSpeed(abs(Output));
49 | if(Output > 0) {
50 | EncodeMotor_1->run(FORWARD);
51 | } else {
52 | EncodeMotor_1->run(BACKWARD);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/arduino_lib/examples/motor_test/servo/servo.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 | Emakefun_MotorDriver mMotorDriver = Emakefun_MotorDriver(0x60);
3 |
4 | Emakefun_Servo *mServo1 = mMotorDriver.getServo(1);
5 | Emakefun_Servo *mServo2 = mMotorDriver.getServo(2);
6 | Emakefun_Servo *mServo3 = mMotorDriver.getServo(3);
7 | Emakefun_Servo *mServo4 = mMotorDriver.getServo(4);
8 | Emakefun_Servo *mServo5 = mMotorDriver.getServo(5);
9 | Emakefun_Servo *mServo6 = mMotorDriver.getServo(6);
10 | Emakefun_Servo *mServo7 = mMotorDriver.getServo(7);
11 | Emakefun_Servo *mServo8 = mMotorDriver.getServo(8);
12 |
13 | void setup()
14 | {
15 | Serial.begin(9600);
16 | mMotorDriver.begin(50);
17 | }
18 |
19 | void loop()
20 | {
21 | mServo1->writeServo(0);
22 | mServo2->writeServo(0);
23 | mServo3->writeServo(0);
24 | mServo4->writeServo(0);
25 | mServo5->writeServo(0);
26 | mServo6->writeServo(0);
27 | mServo7->writeServo(0);
28 | mServo8->writeServo(0);
29 | delay(1000);
30 | mServo1->writeServo(90);
31 | mServo2->writeServo(90);
32 | mServo3->writeServo(90);
33 | mServo4->writeServo(90);
34 | mServo5->writeServo(90);
35 | mServo6->writeServo(90);
36 | mServo7->writeServo(90);
37 | mServo8->writeServo(90);
38 | delay(1000);
39 | mServo1->writeServo(180);
40 | mServo2->writeServo(180);
41 | mServo3->writeServo(180);
42 | mServo4->writeServo(180);
43 | mServo5->writeServo(180);
44 | mServo6->writeServo(180);
45 | mServo7->writeServo(180);
46 | mServo8->writeServo(180);
47 | delay(1000);
48 | }
49 |
--------------------------------------------------------------------------------
/arduino_lib/examples/motor_test/stepper/stepper.ino:
--------------------------------------------------------------------------------
1 | #include "Emakefun_MotorDriver.h"
2 |
3 | Emakefun_MotorDriver mMotorDriver = Emakefun_MotorDriver(0x60);
4 |
5 | Emakefun_StepperMotor *StepperMotor_1 = mMotorDriver.getStepper(STEPPER1, 200);
6 | Emakefun_StepperMotor *StepperMotor_2 = mMotorDriver.getStepper(STEPPER2, 200);
7 |
8 | void setup()
9 | {
10 | Serial.begin(9600);
11 | mMotorDriver.begin(1600);
12 | StepperMotor_1->setSpeed(400);
13 | StepperMotor_2->setSpeed(400);
14 | }
15 |
16 | void loop()
17 | {
18 | StepperMotor_1->step(200, FORWARD, DOUBLE); //电机1正转1圈 200步
19 | StepperMotor_1->release();
20 | StepperMotor_2->step(200, FORWARD, SINGLE); //电机2正转1圈 200步
21 | StepperMotor_2->release();
22 | delay(1000);
23 | StepperMotor_1->step(200, BACKWARD, DOUBLE); //电机1反转1圈 200步
24 | StepperMotor_1->release();
25 | StepperMotor_2->step(200, BACKWARD, SINGLE); //电机2反转1圈 200步
26 | StepperMotor_2->release();
27 | delay(1000);
28 | }
--------------------------------------------------------------------------------
/arduino_lib/keywords.txt:
--------------------------------------------------------------------------------
1 | #######################################
2 | # Classes, datatypes (KEYWORD1)
3 | #######################################
4 |
5 | Emakefun_MotorDriver KEYWORD1
6 | Emakefun_DCMotor KEYWORD1
7 | Emakefun_EncoderMotor KEYWORD1
8 | Emakefun_StepperMotor KEYWORD1
9 | Emakefun_Servo KEYWORD1
10 |
11 | #######################################
12 | # Methods and Functions (KEYWORD2)
13 | #######################################
14 |
15 | FORWARD KEYWORD2
16 | BACKWARD KEYWORD2
17 | BRAKE KEYWORD2
18 | RELEASE KEYWORD2
19 | begin KEYWORD2
20 | getPWM KEYWORD2
21 | setPWM KEYWORD2
22 | setPin KEYWORD2
23 | setServoPulse KEYWORD2
24 | writeServo KEYWORD2
25 | writeServo KEYWORD2
26 | readDegrees KEYWORD2
27 | run KEYWORD2
28 | setSpeed KEYWORD2
29 | step KEYWORD2
30 | onestep KEYWORD2
31 | release KEYWORD2
32 | getMotor KEYWORD2
33 | getStepper KEYWORD2
34 | getEncoderMotor KEYWORD2
35 | getServo KEYWORD2
36 |
37 | #######################################
38 | # Constants (LITERAL1)
39 | #######################################
40 | FREQUENCY_OSCILLATOR LITERAL1
--------------------------------------------------------------------------------
/arduino_lib/library.properties:
--------------------------------------------------------------------------------
1 | name=Emakefun_MotorDriverBoard
2 | version=10
3 | author=emakefun
4 | maintainer=Emakefun
5 | sentence=.
6 | paragraph=.
7 | category=Communication
8 | url=https://github.com/emakefun/MotorDriverBoard
9 | architectures=*
10 | dot_a_linkage=true
11 |
--------------------------------------------------------------------------------
/arduino_lib/src/Emakefun_MS_PWMServoDriver.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************
2 | This is a library for our Emakefun 16-channel PWM & Servo driver
3 |
4 | Pick one up today in the Emakefun shop!
5 | ------> http://www.Emakefun.com/products/815
6 |
7 | These displays use I2C to communicate, 2 pins are required to
8 | interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4
9 |
10 | Emakefun invests time and resources providing this open source code,
11 | please support Emakefun and open-source hardware by purchasing
12 | products from Emakefun!
13 |
14 | Written by Limor Fried/Ladyada for Emakefun Industries.
15 | BSD license, all text above must be included in any redistribution
16 | ****************************************************/
17 |
18 | #include "Emakefun_MS_PWMServoDriver.h"
19 | #include
20 | #if defined(ARDUINO_SAM_DUE)
21 | #define WIRE Wire1
22 | #else
23 | #define WIRE Wire
24 | #endif
25 |
26 | Emakefun_MS_PWMServoDriver::Emakefun_MS_PWMServoDriver(uint8_t addr) {
27 | _i2caddr = addr;
28 | }
29 |
30 | void Emakefun_MS_PWMServoDriver::begin(void) {
31 | WIRE.begin();
32 | reset();
33 | }
34 |
35 | void Emakefun_MS_PWMServoDriver::reset(void) { write8(PCA9685_MODE1, 0x0); }
36 |
37 | void Emakefun_MS_PWMServoDriver::setPWMFreq(float freq) {
38 | // Serial.print("Attempting to set freq ");
39 | // Serial.println(freq);
40 |
41 | // freq *=0.9; // Correct for overshoot in the frequency setting (see issue #11).
42 |
43 | float prescaleval = 25000000;
44 | prescaleval /= 4096;
45 | prescaleval /= freq;
46 | prescaleval -= 1;
47 | // Serial.print("Estimated pre-scale: "); Serial.println(prescaleval);
48 | uint8_t prescale = floor(prescaleval + 0.5);
49 | // Serial.print("Final pre-scale: "); Serial.println(prescale);
50 |
51 | uint8_t oldmode = read8(PCA9685_MODE1);
52 | uint8_t newmode = (oldmode & 0x7F) | 0x10; // sleep
53 | write8(PCA9685_MODE1, newmode); // go to sleep
54 | write8(PCA9685_PRESCALE, prescale); // set the prescaler
55 | write8(PCA9685_MODE1, oldmode);
56 | delay(5);
57 | write8(PCA9685_MODE1,
58 | oldmode |
59 | 0xa1); // This sets the MODE1 register to turn on auto increment.
60 | // This is why the beginTransmission below was not working.
61 | // Serial.print("Mode now 0x"); Serial.println(read8(PCA9685_MODE1), HEX);
62 | }
63 |
64 | void Emakefun_MS_PWMServoDriver::setPWM(uint8_t num, uint16_t on,
65 | uint16_t off) {
66 | // Serial.print("Setting PWM "); Serial.print(num); Serial.print(": ");
67 | // Serial.print(on); Serial.print("->"); Serial.println(off);
68 |
69 | WIRE.beginTransmission(_i2caddr);
70 | #if ARDUINO >= 100
71 | WIRE.write(LED0_ON_L + 4 * num);
72 | WIRE.write(on);
73 | WIRE.write(on >> 8);
74 | WIRE.write(off);
75 | WIRE.write(off >> 8);
76 | #else
77 | WIRE.send(LED0_ON_L + 4 * num);
78 | WIRE.send((uint8_t)on);
79 | WIRE.send((uint8_t)(on >> 8));
80 | WIRE.send((uint8_t)off);
81 | WIRE.send((uint8_t)(off >> 8));
82 | #endif
83 | WIRE.endTransmission();
84 | }
85 |
86 | uint8_t Emakefun_MS_PWMServoDriver::read8(uint8_t addr) {
87 | WIRE.beginTransmission(_i2caddr);
88 | #if ARDUINO >= 100
89 | WIRE.write(addr);
90 | #else
91 | WIRE.send(addr);
92 | #endif
93 | WIRE.endTransmission();
94 |
95 | WIRE.requestFrom((uint8_t)_i2caddr, (uint8_t)1);
96 | #if ARDUINO >= 100
97 | return WIRE.read();
98 | #else
99 | return WIRE.receive();
100 | #endif
101 | }
102 |
103 | void Emakefun_MS_PWMServoDriver::write8(uint8_t addr, uint8_t d) {
104 | WIRE.beginTransmission(_i2caddr);
105 | #if ARDUINO >= 100
106 | WIRE.write(addr);
107 | WIRE.write(d);
108 | #else
109 | WIRE.send(addr);
110 | WIRE.send(d);
111 | #endif
112 | WIRE.endTransmission();
113 | }
114 |
--------------------------------------------------------------------------------
/arduino_lib/src/Emakefun_MS_PWMServoDriver.h:
--------------------------------------------------------------------------------
1 | /***************************************************
2 | This is a library for our Emakefun 16-channel PWM & Servo driver
3 |
4 | Pick one up today in the Emakefun shop!
5 | ------> http://www.Emakefun.com/products/815
6 |
7 | These displays use I2C to communicate, 2 pins are required to
8 | interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4
9 |
10 | Emakefun invests time and resources providing this open source code,
11 | please support Emakefun and open-source hardware by purchasing
12 | products from Emakefun!
13 |
14 | Written by Limor Fried/Ladyada for Emakefun Industries.
15 | BSD license, all text above must be included in any redistribution
16 | ****************************************************/
17 |
18 | #ifndef _Emakefun_MS_PWMServoDriver_H
19 | #define _Emakefun_MS_PWMServoDriver_H
20 |
21 | #if ARDUINO >= 100
22 | #include "Arduino.h"
23 | #else
24 | #include "WProgram.h"
25 | #endif
26 |
27 | #define PCA9685_SUBADR1 0x2
28 | #define PCA9685_SUBADR2 0x3
29 | #define PCA9685_SUBADR3 0x4
30 |
31 | #define PCA9685_MODE1 0x0
32 | #define PCA9685_PRESCALE 0xFE
33 |
34 | #define LED0_ON_L 0x6
35 | #define LED0_ON_H 0x7
36 | #define LED0_OFF_L 0x8
37 | #define LED0_OFF_H 0x9
38 |
39 | #define ALLLED_ON_L 0xFA
40 | #define ALLLED_ON_H 0xFB
41 | #define ALLLED_OFF_L 0xFC
42 | #define ALLLED_OFF_H 0xFD
43 |
44 | class Emakefun_MS_PWMServoDriver {
45 | public:
46 | Emakefun_MS_PWMServoDriver(uint8_t addr = 0x40);
47 | void begin(void);
48 | void reset(void);
49 | void setPWMFreq(float freq);
50 | void setPWM(uint8_t num, uint16_t on, uint16_t off);
51 |
52 | private:
53 | uint8_t _i2caddr;
54 |
55 | uint8_t read8(uint8_t addr);
56 | void write8(uint8_t addr, uint8_t d);
57 | };
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/arduino_lib/src/Emakefun_MotorDriver.h:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************
3 | This is the library for the Emakefun Motor Shield V2 for Arduino.
4 | It supports DC motors & Stepper motors with microstepping as well
5 | as stacking-support. It is *not* compatible with the V1 library!
6 |
7 | It will only work with https://www.Emakefun.com/products/1483
8 |
9 | Emakefun invests time and resources providing this open
10 | source code, please support Emakefun and open-source hardware
11 | by purchasing products from Emakefun!
12 |
13 | Written by Limor Fried/Ladyada for Emakefun Industries.
14 | BSD license, check license.txt for more information.
15 | All text above must be included in any redistribution.
16 | ******************************************************************/
17 |
18 | #ifndef _Emakefun_MotorDriver_h_
19 | #define _Emakefun_MotorDriver_h_
20 |
21 | #include "Emakefun_MS_PWMServoDriver.h"
22 | #include
23 | #include
24 |
25 | //#define MOTORDEBUG
26 | #define MOTOR_DRIVER_V5_2
27 |
28 | #define MICROSTEPS 8 // 8 or 16
29 |
30 | #define MOTOR1_A 2
31 | #define MOTOR1_B 3
32 | #define MOTOR2_A 1
33 | #define MOTOR2_B 4
34 | #define MOTOR4_A 0
35 | #define MOTOR4_B 6
36 | #define MOTOR3_A 5
37 | #define MOTOR3_B 7
38 |
39 | #define FORWARD 1
40 | #define BACKWARD 2
41 | #define BRAKE 3
42 | #define RELEASE 4
43 |
44 | #define SINGLE 1
45 | #define DOUBLE 2
46 | #define INTERLEAVE 3
47 | #define MICROSTEP 4
48 |
49 | #define S1 0
50 | #define S2 1
51 | #define S3 14
52 | #define S4 15
53 | #define S5 3
54 | #define S6 6
55 | #define S7 9
56 | #define S8 12
57 |
58 | #define M1 1
59 | #define M2 2
60 | #define M3 3
61 | #define M4 4
62 |
63 | #define E1 1
64 | #define E2 2
65 | #define E3 3
66 | #define E4 4
67 |
68 | #define STEPPER1 1
69 | #define STEPPER2 2
70 |
71 | class Emakefun_MotorDriver;
72 | /** Object that controls and keeps state for a Servo */
73 | class Emakefun_Servo
74 | {
75 | public:
76 | Emakefun_Servo(void);
77 | friend class Emakefun_MotorDriver;
78 | void setServoPulse(double pulse);
79 | void writeServo(uint8_t angle);
80 | void writeServo(uint8_t angle, uint8_t speed);
81 | uint8_t readDegrees();
82 | private:
83 | uint8_t PWMpin;
84 | uint16_t PWMfreq;
85 | Emakefun_MotorDriver *MC;
86 | uint8_t servonum, currentAngle;
87 | };
88 |
89 |
90 | /** Object that controls and keeps state for a single DC motor */
91 | class Emakefun_DCMotor {
92 | public:
93 | Emakefun_DCMotor(void);
94 | friend class Emakefun_MotorDriver; ///< Let MotorShield create DCMotors
95 | void run(uint8_t);
96 | void setSpeed(uint8_t);
97 |
98 | private:
99 | uint8_t IN1pin, IN2pin;
100 | Emakefun_MotorDriver *MC;
101 | // int DcSpeed;
102 | uint8_t motornum;
103 | };
104 |
105 | /** Object that controls and keeps state for a single stepper motor */
106 | class Emakefun_StepperMotor {
107 | public:
108 | Emakefun_StepperMotor(void);
109 | void setSpeed(uint16_t);
110 |
111 | void step(uint16_t steps, uint8_t dir, uint8_t style = SINGLE);
112 | uint8_t onestep(uint8_t dir, uint8_t style);
113 | void release(void);
114 |
115 | friend class Emakefun_MotorDriver; ///< Let MotorShield create StepperMotors
116 |
117 | private:
118 | uint32_t usperstep;
119 |
120 | uint8_t AIN1pin, AIN2pin;
121 | uint8_t BIN1pin, BIN2pin;
122 | uint16_t revsteps; // # steps per revolution
123 | uint8_t currentstep;
124 | Emakefun_MotorDriver *MC;
125 | uint8_t steppernum;
126 | };
127 |
128 | typedef void (*FuncPtr)(void);
129 |
130 | class Emakefun_EncoderMotor {
131 | public:
132 | Emakefun_EncoderMotor(void);
133 | friend class Emakefun_MotorDriver;
134 | void run(uint8_t);
135 | void run(uint8_t cmd, uint8_t speed, int pluse);
136 | void setSpeed(uint8_t);
137 | //void release(void);
138 | void init(FuncPtr encoder_fun);
139 | FuncPtr EncoderCallback;
140 | // private:
141 | uint8_t IN1pin, IN2pin;
142 | uint8_t ENCODER1pin, ENCODER2pin;
143 | volatile int EncoderPulse;
144 | private:
145 | Emakefun_MotorDriver *MC;
146 | uint8_t encodernum;
147 | };
148 |
149 | /** Object that controls and keeps state for the whole motor shield.
150 | Use it to create DC and Stepper motor objects! */
151 | class Emakefun_MotorDriver {
152 | public:
153 | Emakefun_MotorDriver(uint8_t addr = 0x60);
154 |
155 | void begin(uint16_t freq = 1600, TwoWire *theWire = NULL);
156 | Emakefun_DCMotor *getMotor(uint8_t n);
157 | Emakefun_StepperMotor *getStepper(uint8_t num, uint16_t steps);
158 | Emakefun_EncoderMotor *getEncoderMotor(uint8_t num);
159 | Emakefun_Servo *getServo(uint8_t num);
160 | friend class Emakefun_DCMotor; //< Let DCMotors control the Shield
161 | friend class Emakefun_EncoderMotor;
162 |
163 | void setPWM(uint8_t pin, uint16_t val);
164 | void setPin(uint8_t pin, boolean val);
165 | int DcSpeed;
166 |
167 | private:
168 | TwoWire *_i2c;
169 | uint8_t _addr;
170 | uint16_t _freq;
171 |
172 | Emakefun_Servo servos[8];
173 | Emakefun_DCMotor dcmotors[4];
174 | Emakefun_StepperMotor steppers[2];
175 | Emakefun_EncoderMotor encoder[4];
176 | Emakefun_MS_PWMServoDriver _pwm;
177 | };
178 |
179 | #endif
180 |
--------------------------------------------------------------------------------
/arduino_lib/src/MsTimer2.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | MsTimer2.h - Using timer2 with 1ms resolution
3 | Javier Valencia
4 |
5 | https://github.com/PaulStoffregen/MsTimer2
6 |
7 | History:
8 | 6/Jun/14 - V0.7 added support for Teensy 3.0 & 3.1
9 | 29/Dec/11 - V0.6 added support for ATmega32u4, AT90USB646, AT90USB1286 (paul@pjrc.com)
10 | some improvements added by Bill Perry
11 | note: uses timer4 on Atmega32u4
12 | 29/May/09 - V0.5 added support for Atmega1280 (thanks to Manuel Negri)
13 | 19/Mar/09 - V0.4 added support for ATmega328P (thanks to Jerome Despatis)
14 | 11/Jun/08 - V0.3
15 | changes to allow working with different CPU frequencies
16 | added support for ATMega128 (using timer2)
17 | compatible with ATMega48/88/168/8
18 | 10/May/08 - V0.2 added some security tests and volatile keywords
19 | 9/May/08 - V0.1 released working on ATMEGA168 only
20 |
21 |
22 | This library is free software; you can redistribute it and/or
23 | modify it under the terms of the GNU Lesser General Public
24 | License as published by the Free Software Foundation; either
25 | version 2.1 of the License, or (at your option) any later version.
26 |
27 | This library is distributed in the hope that it will be useful,
28 | but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 | Lesser General Public License for more details.
31 |
32 | You should have received a copy of the GNU Lesser General Public
33 | License along with this library; if not, write to the Free Software
34 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35 | */
36 |
37 | #include "MsTimer2.h"
38 |
39 | unsigned long MsTimer2::msecs;
40 | void (*MsTimer2::func)();
41 | volatile unsigned long MsTimer2::count;
42 | volatile char MsTimer2::overflowing;
43 | volatile unsigned int MsTimer2::tcnt2;
44 | #if defined(__arm__) && defined(TEENSYDUINO)
45 | static IntervalTimer itimer;
46 | #endif
47 |
48 | void MsTimer2::set(unsigned long ms, void (*f)()) {
49 | float prescaler = 0.0;
50 |
51 | if (ms == 0)
52 | msecs = 1;
53 | else
54 | msecs = ms;
55 |
56 | func = f;
57 |
58 | #if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
59 | TIMSK2 &= ~(1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
66 | TCCR2B |= (1< 16Mhz, prescaler set to 128
74 | TCCR2B |= ((1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
85 | TCCR2 |= (1< 16Mhz, prescaler set to 128
93 | TCCR2 |= ((1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
103 | TCCR2 |= ((1< 16Mhz, prescaler set to 256
111 | TCCR2 |= (1<= 16000000L) {
122 | TCCR4B = (1<= 8000000L) {
125 | TCCR4B = (1<= 4000000L) {
128 | TCCR4B = (1<= 2000000L) {
131 | TCCR4B = (1<= 1000000L) {
134 | TCCR4B = (1<= 500000L) {
137 | TCCR4B = (1<= msecs && !overflowing) {
194 | overflowing = 1;
195 | count = count - msecs; // subtract ms to catch missed overflows
196 | // set to 0 if you don't want this.
197 | (*func)();
198 | overflowing = 0;
199 | }
200 | }
201 |
202 | #if defined (__AVR__)
203 | #if defined (__AVR_ATmega32U4__)
204 | ISR(TIMER4_OVF_vect) {
205 | #else
206 | ISR(TIMER2_OVF_vect) {
207 | #endif
208 | #if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined (__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
209 | TCNT2 = MsTimer2::tcnt2;
210 | #elif defined (__AVR_ATmega128__)
211 | TCNT2 = MsTimer2::tcnt2;
212 | #elif defined (__AVR_ATmega8__)
213 | TCNT2 = MsTimer2::tcnt2;
214 | #elif defined (__AVR_ATmega32U4__)
215 | // not necessary on 32u4's high speed timer4
216 | #endif
217 | MsTimer2::_overflow();
218 | }
219 | #endif // AVR
220 |
--------------------------------------------------------------------------------
/arduino_lib/src/MsTimer2.h:
--------------------------------------------------------------------------------
1 | #ifndef MsTimer2_h
2 | #define MsTimer2_h
3 |
4 | #ifdef __AVR__
5 | #include
6 | #elif defined(__arm__) && defined(TEENSYDUINO)
7 | #include
8 | #else
9 | #error MsTimer2 library only works on AVR architecture
10 | #endif
11 |
12 | namespace MsTimer2 {
13 | extern unsigned long msecs;
14 | extern void (*func)();
15 | extern volatile unsigned long count;
16 | extern volatile char overflowing;
17 | extern volatile unsigned int tcnt2;
18 |
19 | void set(unsigned long ms, void (*f)());
20 | void start();
21 | void stop();
22 | void _overflow();
23 | }
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/arduino_lib/src/PID_v1.cpp:
--------------------------------------------------------------------------------
1 | /**********************************************************************************************
2 | * Arduino PID Library - Version 1.2.1
3 | * by Brett Beauregard brettbeauregard.com
4 | *
5 | * This Library is licensed under the MIT License
6 | **********************************************************************************************/
7 |
8 | #if ARDUINO >= 100
9 | #include "Arduino.h"
10 | #else
11 | #include "WProgram.h"
12 | #endif
13 |
14 | #include "PID_v1.h"
15 |
16 | /*Constructor (...)*********************************************************
17 | * The parameters specified here are those for for which we can't set up
18 | * reliable defaults, so we need to have the user set them.
19 | ***************************************************************************/
20 | PID::PID(double* Input, double* Output, double* Setpoint,
21 | double Kp, double Ki, double Kd, int POn, int ControllerDirection)
22 | {
23 | myOutput = Output;
24 | myInput = Input;
25 | mySetpoint = Setpoint;
26 | inAuto = false;
27 |
28 | PID::SetOutputLimits(0, 255); //default output limit corresponds to
29 | //the arduino pwm limits
30 |
31 | SampleTime = 100; //default Controller Sample Time is 0.1 seconds
32 |
33 | PID::SetControllerDirection(ControllerDirection);
34 | PID::SetTunings(Kp, Ki, Kd, POn);
35 |
36 | lastTime = millis()-SampleTime;
37 | }
38 |
39 | /*Constructor (...)*********************************************************
40 | * To allow backwards compatability for v1.1, or for people that just want
41 | * to use Proportional on Error without explicitly saying so
42 | ***************************************************************************/
43 |
44 | PID::PID(double* Input, double* Output, double* Setpoint,
45 | double Kp, double Ki, double Kd, int ControllerDirection)
46 | :PID::PID(Input, Output, Setpoint, Kp, Ki, Kd, P_ON_E, ControllerDirection)
47 | {
48 |
49 | }
50 |
51 |
52 | /* Compute() **********************************************************************
53 | * This, as they say, is where the magic happens. this function should be called
54 | * every time "void loop()" executes. the function will decide for itself whether a new
55 | * pid Output needs to be computed. returns true when the output is computed,
56 | * false when nothing has been done.
57 | **********************************************************************************/
58 | bool PID::Compute()
59 | {
60 | if(!inAuto) return false;
61 | unsigned long now = millis();
62 | unsigned long timeChange = (now - lastTime);
63 | if(timeChange>=SampleTime)
64 | {
65 | /*Compute all the working error variables*/
66 | double input = *myInput;
67 | double error = *mySetpoint - input;
68 | double dInput = (input - lastInput);
69 | outputSum+= (ki * error);
70 |
71 | /*Add Proportional on Measurement, if P_ON_M is specified*/
72 | if(!pOnE) outputSum-= kp * dInput;
73 |
74 | if(outputSum > outMax) outputSum= outMax;
75 | else if(outputSum < outMin) outputSum= outMin;
76 |
77 | /*Add Proportional on Error, if P_ON_E is specified*/
78 | double output;
79 | if(pOnE) output = kp * error;
80 | else output = 0;
81 |
82 | /*Compute Rest of PID Output*/
83 | output += outputSum - kd * dInput;
84 |
85 | if(output > outMax) output = outMax;
86 | else if(output < outMin) output = outMin;
87 | *myOutput = output;
88 |
89 | /*Remember some variables for next time*/
90 | lastInput = input;
91 | lastTime = now;
92 | return true;
93 | }
94 | else return false;
95 | }
96 |
97 | /* SetTunings(...)*************************************************************
98 | * This function allows the controller's dynamic performance to be adjusted.
99 | * it's called automatically from the constructor, but tunings can also
100 | * be adjusted on the fly during normal operation
101 | ******************************************************************************/
102 | void PID::SetTunings(double Kp, double Ki, double Kd, int POn)
103 | {
104 | if (Kp<0 || Ki<0 || Kd<0) return;
105 |
106 | pOn = POn;
107 | pOnE = POn == P_ON_E;
108 |
109 | dispKp = Kp; dispKi = Ki; dispKd = Kd;
110 |
111 | double SampleTimeInSec = ((double)SampleTime)/1000;
112 | kp = Kp;
113 | ki = Ki * SampleTimeInSec;
114 | kd = Kd / SampleTimeInSec;
115 |
116 | if(controllerDirection ==REVERSE)
117 | {
118 | kp = (0 - kp);
119 | ki = (0 - ki);
120 | kd = (0 - kd);
121 | }
122 | }
123 |
124 | /* SetTunings(...)*************************************************************
125 | * Set Tunings using the last-rembered POn setting
126 | ******************************************************************************/
127 | void PID::SetTunings(double Kp, double Ki, double Kd){
128 | SetTunings(Kp, Ki, Kd, pOn);
129 | }
130 |
131 | /* SetSampleTime(...) *********************************************************
132 | * sets the period, in Milliseconds, at which the calculation is performed
133 | ******************************************************************************/
134 | void PID::SetSampleTime(int NewSampleTime)
135 | {
136 | if (NewSampleTime > 0)
137 | {
138 | double ratio = (double)NewSampleTime
139 | / (double)SampleTime;
140 | ki *= ratio;
141 | kd /= ratio;
142 | SampleTime = (unsigned long)NewSampleTime;
143 | }
144 | }
145 |
146 | /* SetOutputLimits(...)****************************************************
147 | * This function will be used far more often than SetInputLimits. while
148 | * the input to the controller will generally be in the 0-1023 range (which is
149 | * the default already,) the output will be a little different. maybe they'll
150 | * be doing a time window and will need 0-8000 or something. or maybe they'll
151 | * want to clamp it from 0-125. who knows. at any rate, that can all be done
152 | * here.
153 | **************************************************************************/
154 | void PID::SetOutputLimits(double Min, double Max)
155 | {
156 | if(Min >= Max) return;
157 | outMin = Min;
158 | outMax = Max;
159 |
160 | if(inAuto)
161 | {
162 | if(*myOutput > outMax) *myOutput = outMax;
163 | else if(*myOutput < outMin) *myOutput = outMin;
164 |
165 | if(outputSum > outMax) outputSum= outMax;
166 | else if(outputSum < outMin) outputSum= outMin;
167 | }
168 | }
169 |
170 | /* SetMode(...)****************************************************************
171 | * Allows the controller Mode to be set to manual (0) or Automatic (non-zero)
172 | * when the transition from manual to auto occurs, the controller is
173 | * automatically initialized
174 | ******************************************************************************/
175 | void PID::SetMode(int Mode)
176 | {
177 | bool newAuto = (Mode == AUTOMATIC);
178 | if(newAuto && !inAuto)
179 | { /*we just went from manual to auto*/
180 | PID::Initialize();
181 | }
182 | inAuto = newAuto;
183 | }
184 |
185 | /* Initialize()****************************************************************
186 | * does all the things that need to happen to ensure a bumpless transfer
187 | * from manual to automatic mode.
188 | ******************************************************************************/
189 | void PID::Initialize()
190 | {
191 | outputSum = *myOutput;
192 | lastInput = *myInput;
193 | if(outputSum > outMax) outputSum = outMax;
194 | else if(outputSum < outMin) outputSum = outMin;
195 | }
196 |
197 | /* SetControllerDirection(...)*************************************************
198 | * The PID will either be connected to a DIRECT acting process (+Output leads
199 | * to +Input) or a REVERSE acting process(+Output leads to -Input.) we need to
200 | * know which one, because otherwise we may increase the output when we should
201 | * be decreasing. This is called from the constructor.
202 | ******************************************************************************/
203 | void PID::SetControllerDirection(int Direction)
204 | {
205 | if(inAuto && Direction !=controllerDirection)
206 | {
207 | kp = (0 - kp);
208 | ki = (0 - ki);
209 | kd = (0 - kd);
210 | }
211 | controllerDirection = Direction;
212 | }
213 |
214 | /* Status Funcions*************************************************************
215 | * Just because you set the Kp=-1 doesn't mean it actually happened. these
216 | * functions query the internal state of the PID. they're here for display
217 | * purposes. this are the functions the PID Front-end uses for example
218 | ******************************************************************************/
219 | double PID::GetKp(){ return dispKp; }
220 | double PID::GetKi(){ return dispKi;}
221 | double PID::GetKd(){ return dispKd;}
222 | int PID::GetMode(){ return inAuto ? AUTOMATIC : MANUAL;}
223 | int PID::GetDirection(){ return controllerDirection;}
224 |
--------------------------------------------------------------------------------
/arduino_lib/src/PID_v1.h:
--------------------------------------------------------------------------------
1 | #ifndef PID_v1_h
2 | #define PID_v1_h
3 | #define LIBRARY_VERSION 1.2.1
4 |
5 | class PID
6 | {
7 |
8 |
9 | public:
10 |
11 | //Constants used in some of the functions below
12 | #define AUTOMATIC 1
13 | #define MANUAL 0
14 | #define DIRECT 0
15 | #define REVERSE 1
16 | #define P_ON_M 0
17 | #define P_ON_E 1
18 |
19 | //commonly used functions **************************************************************************
20 | PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and
21 | double, double, double, int, int);// Setpoint. Initial tuning parameters are also set here.
22 | // (overload for specifying proportional mode)
23 |
24 | PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and
25 | double, double, double, int); // Setpoint. Initial tuning parameters are also set here
26 |
27 | void SetMode(int Mode); // * sets PID to either Manual (0) or Auto (non-0)
28 |
29 | bool Compute(); // * performs the PID calculation. it should be
30 | // called every time loop() cycles. ON/OFF and
31 | // calculation frequency can be set using SetMode
32 | // SetSampleTime respectively
33 |
34 | void SetOutputLimits(double, double); // * clamps the output to a specific range. 0-255 by default, but
35 | // it's likely the user will want to change this depending on
36 | // the application
37 |
38 |
39 |
40 | //available but not commonly used functions ********************************************************
41 | void SetTunings(double, double, // * While most users will set the tunings once in the
42 | double); // constructor, this function gives the user the option
43 | // of changing tunings during runtime for Adaptive control
44 | void SetTunings(double, double, // * overload for specifying proportional mode
45 | double, int);
46 |
47 | void SetControllerDirection(int); // * Sets the Direction, or "Action" of the controller. DIRECT
48 | // means the output will increase when error is positive. REVERSE
49 | // means the opposite. it's very unlikely that this will be needed
50 | // once it is set in the constructor.
51 | void SetSampleTime(int); // * sets the frequency, in Milliseconds, with which
52 | // the PID calculation is performed. default is 100
53 |
54 |
55 |
56 | //Display functions ****************************************************************
57 | double GetKp(); // These functions query the pid for interal values.
58 | double GetKi(); // they were created mainly for the pid front-end,
59 | double GetKd(); // where it's important to know what is actually
60 | int GetMode(); // inside the PID.
61 | int GetDirection(); //
62 |
63 | private:
64 | void Initialize();
65 |
66 | double dispKp; // * we'll hold on to the tuning parameters in user-entered
67 | double dispKi; // format for display purposes
68 | double dispKd; //
69 |
70 | double kp; // * (P)roportional Tuning Parameter
71 | double ki; // * (I)ntegral Tuning Parameter
72 | double kd; // * (D)erivative Tuning Parameter
73 |
74 | int controllerDirection;
75 | int pOn;
76 |
77 | double *myInput; // * Pointers to the Input, Output, and Setpoint variables
78 | double *myOutput; // This creates a hard link between the variables and the
79 | double *mySetpoint; // PID, freeing the user from having to constantly tell us
80 | // what these values are. with pointers we'll just know.
81 |
82 | unsigned long lastTime;
83 | double outputSum, lastInput;
84 |
85 | unsigned long SampleTime;
86 | double outMin, outMax;
87 | bool inAuto, pOnE;
88 | };
89 | #endif
90 |
91 |
--------------------------------------------------------------------------------
/doc/MotorDriverBoard_V5.2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/MotorDriverBoard_V5.2.pdf
--------------------------------------------------------------------------------
/doc/PCA9685.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/PCA9685.pdf
--------------------------------------------------------------------------------
/doc/picture/EN/MotorDriverBoard_show0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/MotorDriverBoard_show0.jpg
--------------------------------------------------------------------------------
/doc/picture/EN/MotorDriverBoard_show1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/MotorDriverBoard_show1.png
--------------------------------------------------------------------------------
/doc/picture/EN/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/back.png
--------------------------------------------------------------------------------
/doc/picture/EN/dc_dc_servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/dc_dc_servo.png
--------------------------------------------------------------------------------
/doc/picture/EN/dc_power_supply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/dc_power_supply.png
--------------------------------------------------------------------------------
/doc/picture/EN/extra_power_supply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/extra_power_supply.png
--------------------------------------------------------------------------------
/doc/picture/EN/hardwareIntroduction.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/hardwareIntroduction.jpg
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/dc_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/dc_init.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/init.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/init_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/init_encoder.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/run_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/run_dc.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/run_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/run_encoder.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/run_servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/run_servo.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/run_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/run_stepper.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/servo_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/servo_init.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/set_freq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/set_freq.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/set_mode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/set_mode.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/set_pwm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/set_pwm.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/stepper_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/stepper_init.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/stop_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/stop_dc.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/stop_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/stop_encoder.png
--------------------------------------------------------------------------------
/doc/picture/EN/mblock/stop_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/mblock/stop_stepper.png
--------------------------------------------------------------------------------
/doc/picture/EN/md_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/md_stepper.png
--------------------------------------------------------------------------------
/doc/picture/EN/pid_encoder.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/pid_encoder.jpg
--------------------------------------------------------------------------------
/doc/picture/EN/power_supply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/power_supply.png
--------------------------------------------------------------------------------
/doc/picture/EN/servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/servo.png
--------------------------------------------------------------------------------
/doc/picture/EN/terminal_power_servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/terminal_power_servo.png
--------------------------------------------------------------------------------
/doc/picture/EN/terminal_power_supply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/EN/terminal_power_supply.png
--------------------------------------------------------------------------------
/doc/picture/ZH/MotorDriverBoard_show0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/MotorDriverBoard_show0.jpg
--------------------------------------------------------------------------------
/doc/picture/ZH/MotorDriverBoard_show1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/MotorDriverBoard_show1.png
--------------------------------------------------------------------------------
/doc/picture/ZH/Ps2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/Ps2.png
--------------------------------------------------------------------------------
/doc/picture/ZH/dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/dc.png
--------------------------------------------------------------------------------
/doc/picture/ZH/dc_power_supply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/dc_power_supply.png
--------------------------------------------------------------------------------
/doc/picture/ZH/dc_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/dc_test.png
--------------------------------------------------------------------------------
/doc/picture/ZH/encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/encoder_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/encoder_test.png
--------------------------------------------------------------------------------
/doc/picture/ZH/examples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/examples.png
--------------------------------------------------------------------------------
/doc/picture/ZH/gpio_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/gpio_test.png
--------------------------------------------------------------------------------
/doc/picture/ZH/hardwareIntroduction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/hardwareIntroduction.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/dc_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/dc_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/download.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/init_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/init_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/mb_install_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/mb_install_success.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/run_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/run_dc.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/run_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/run_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/run_servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/run_servo.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/run_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/run_stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/servo_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/servo_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/set_freq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/set_freq.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/set_mode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/set_mode.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/set_pwm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/set_pwm.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/stepper_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/stepper_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/stop_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/stop_dc.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/stop_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/stop_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mblock/stop_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mblock/stop_stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/dc_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/dc_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/extention-pkg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/extention-pkg.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/init_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/init_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/mindplus-ps2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/mindplus-ps2.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/pwm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/pwm.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/readDegrees.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/readDegrees.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/run_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/run_dc.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/run_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/run_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/run_servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/run_servo.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/run_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/run_stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/servo_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/servo_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/set_freq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/set_freq.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/set_mode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/set_mode.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/stop_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/stop_dc.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/stop_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/stop_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/stop_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/stop_stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/user-lib-step01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/user-lib-step01.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/user-lib-step02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/user-lib-step02.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/user-lib-step03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/user-lib-step03.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/user-lib-step04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/user-lib-step04.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mind+/user-lib-step05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mind+/user-lib-step05.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/dc_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/dc_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/download.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/init_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/init_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/install_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/install_success.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/local_install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/local_install.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/mixly_guanli.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/mixly_guanli.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/mixly_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/mixly_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/mixly_kuanzhuang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/mixly_kuanzhuang.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/mixly_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/mixly_success.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/run_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/run_dc.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/run_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/run_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/run_servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/run_servo.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/run_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/run_stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/select_xml.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/select_xml.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/servo_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/servo_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/set_freq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/set_freq.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/set_mode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/set_mode.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/set_pwm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/set_pwm.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/stepper_init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/stepper_init.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/stop_dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/stop_dc.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/stop_encoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/stop_encoder.png
--------------------------------------------------------------------------------
/doc/picture/ZH/mixly/stop_stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/mixly/stop_stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/pid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/pid.png
--------------------------------------------------------------------------------
/doc/picture/ZH/pid_i.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/pid_i.png
--------------------------------------------------------------------------------
/doc/picture/ZH/pid_p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/pid_p.png
--------------------------------------------------------------------------------
/doc/picture/ZH/ps2_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/ps2_test.png
--------------------------------------------------------------------------------
/doc/picture/ZH/pwm_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/pwm_test.png
--------------------------------------------------------------------------------
/doc/picture/ZH/servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/servo.png
--------------------------------------------------------------------------------
/doc/picture/ZH/servo_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/servo_test.png
--------------------------------------------------------------------------------
/doc/picture/ZH/stepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/stepper.png
--------------------------------------------------------------------------------
/doc/picture/ZH/stepper_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/stepper_test.png
--------------------------------------------------------------------------------
/doc/picture/ZH/terminal_power_servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/terminal_power_servo.png
--------------------------------------------------------------------------------
/doc/picture/ZH/terminal_power_supply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/doc/picture/ZH/terminal_power_supply.png
--------------------------------------------------------------------------------
/example/mblock5/dc_test.mblock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mblock5/dc_test.mblock
--------------------------------------------------------------------------------
/example/mblock5/encoder_test.mblock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mblock5/encoder_test.mblock
--------------------------------------------------------------------------------
/example/mblock5/gpio_test.mblock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mblock5/gpio_test.mblock
--------------------------------------------------------------------------------
/example/mblock5/ps2_test.mblock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mblock5/ps2_test.mblock
--------------------------------------------------------------------------------
/example/mblock5/pwm_test.mblock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mblock5/pwm_test.mblock
--------------------------------------------------------------------------------
/example/mblock5/servo_test.mblock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mblock5/servo_test.mblock
--------------------------------------------------------------------------------
/example/mblock5/stepper_test.mblock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mblock5/stepper_test.mblock
--------------------------------------------------------------------------------
/example/mind+/DCMotorExample.mp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mind+/DCMotorExample.mp
--------------------------------------------------------------------------------
/example/mind+/EncoderMotorExample.mp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mind+/EncoderMotorExample.mp
--------------------------------------------------------------------------------
/example/mind+/PS2ControlCar.mp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mind+/PS2ControlCar.mp
--------------------------------------------------------------------------------
/example/mind+/PS2TestExample.mp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mind+/PS2TestExample.mp
--------------------------------------------------------------------------------
/example/mind+/ServoMotorExample.mp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mind+/ServoMotorExample.mp
--------------------------------------------------------------------------------
/example/mind+/StepperMotorExample.mp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mind+/StepperMotorExample.mp
--------------------------------------------------------------------------------
/example/mixly/PS2ControlCar.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/PS2ControlCar.zip
--------------------------------------------------------------------------------
/example/mixly/dc_test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/dc_test.zip
--------------------------------------------------------------------------------
/example/mixly/encoder_test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/encoder_test.zip
--------------------------------------------------------------------------------
/example/mixly/gpio_test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/gpio_test.zip
--------------------------------------------------------------------------------
/example/mixly/ps2_test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/ps2_test.zip
--------------------------------------------------------------------------------
/example/mixly/pwm_test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/pwm_test.zip
--------------------------------------------------------------------------------
/example/mixly/servo_test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/servo_test.zip
--------------------------------------------------------------------------------
/example/mixly/stepper_test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/example/mixly/stepper_test.zip
--------------------------------------------------------------------------------
/mblock5/ext_motordriverboard.mext:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/mblock5/ext_motordriverboard.mext
--------------------------------------------------------------------------------
/mind+/ext-MotorDriverBoard/arduinoC/_images/featured.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/mind+/ext-MotorDriverBoard/arduinoC/_images/featured.png
--------------------------------------------------------------------------------
/mind+/ext-MotorDriverBoard/arduinoC/_images/icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/mind+/ext-MotorDriverBoard/arduinoC/_locales/zh-cn.json:
--------------------------------------------------------------------------------
1 | {
2 | "MotorDriverBoard.LEVELS.HIGH|menu": "高电平",
3 | "MotorDriverBoard.LEVELS.LOW|menu": "低电平",
4 |
5 | "MotorDriverBoard.DIRECTIONS.FORWARD|menu": "正转",
6 | "MotorDriverBoard.DIRECTIONS.BACKWARD|menu": "反转",
7 | "MotorDriverBoard.DIRECTIONS.BRAKE|menu": "刹车",
8 | "MotorDriverBoard.DIRECTIONS.RELEASE|menu": "释放",
9 |
10 | "MotorDriverBoard.STEPPER_DIRECTIONS.FORWARD|menu": "正转",
11 | "MotorDriverBoard.STEPPER_DIRECTIONS.BACKWARD|menu": "反转",
12 |
13 | "MotorDriverBoard.MODES.DOUBLE|menu": "全步",
14 | "MotorDriverBoard.MODES.SINGLE|menu": "单步",
15 | "MotorDriverBoard.MODES.INTERLEAVE|menu": "半步",
16 |
17 | "MotorDriverBoard.init|block": "MotorDriverBoard初始化",
18 | "MotorDriverBoard.setIOFrequency|block": "设置IO口输出频率(1-1600HZ)为 [FREQ]",
19 | "MotorDriverBoard.setIOPinLevel|block": "MotorDriverBoard控制IO口 [PIN] 设置 [LEVEL]",
20 | "MotorDriverBoard.setIOPinPwm|block": "MotorDriverBoard控制IO口 [PIN] 设置输出PWM的值(0-4096) [PWM]",
21 |
22 | "MotorDriverBoard.initDCMotor|block": "直流电机初始化 [MOTOR]",
23 | "MotorDriverBoard.controlDCMotor|block": "直流电机 [MOTOR] 方向 [DIRECTION] 速度(0-255) [SPEED]",
24 | "MotorDriverBoard.stopDCMotor|block": "停止直流电机 [MOTOR]",
25 |
26 | "MotorDriverBoard.initEncoderMotor|block": "编码电机初始化 [ENCODER]",
27 | "MotorDriverBoard.controlEncoderMotor|block": "编码电机 [ENCODER] 方向 [DIRECTION] 速度(0-255) [SPEED]",
28 | "MotorDriverBoard.stopEncoderMotor|block": "停止编码电机 [ENCODER]",
29 |
30 | "MotorDriverBoard.initStepperMotor|block": "步进电机初始化 [STEPPER] 步数(步/圈) [STEP] 每分钟的圈数 [LAP]",
31 | "MotorDriverBoard.controlStepperMotor|block": "步进电机 [STEPPER] 方向 [DIRECTION] 驱动方式(半步/单步) [MODE] 运动步数 [STEP]",
32 | "MotorDriverBoard.stopStepperMotor|block": "停止步进电机 [STEPPER]",
33 |
34 | "MotorDriverBoard.initServoMotor|block": "舵机初始化 接口[SERVO]",
35 | "MotorDriverBoard.controlServoMotor|block": "舵机接口 [SERVO] 角度 [ANGLE] 速度(0-10) [SPEED]",
36 | "MotorDriverBoard.readServoMotorAngle|block": "舵机接口 [SERVO] 读取当前舵机角度"
37 | }
--------------------------------------------------------------------------------
/mind+/ext-MotorDriverBoard/arduinoC/_menus/arduino.json:
--------------------------------------------------------------------------------
1 | {
2 | "PIN_AnalogWrite": {
3 | "menu": [
4 | ["3", "3"],
5 | ["5", "5"],
6 | ["6", "6"],
7 | ["9", "9"],
8 | ["10(SS)", "10"],
9 | ["11(MOSI)", "11"]
10 | ]
11 | },
12 | "PIN_AnalogRead": {
13 | "menu": [
14 | ["A0", "A0"],
15 | ["A1", "A1"],
16 | ["A2", "A2"],
17 | ["A3", "A3"],
18 | ["A4(SDA)", "A4"],
19 | ["A5(SCL)", "A5"],
20 | ["A6", "A6"],
21 | ["A7", "A7"]
22 | ]
23 | },
24 | "PIN_DigitalWrite": {
25 | "menu": [
26 | ["2", "2"],
27 | ["0(RX)", "0"],
28 | ["1(TX)", "1"],
29 | ["3", "3"],
30 | ["4", "4"],
31 | ["5", "5"],
32 | ["6", "6"],
33 | ["7", "7"],
34 | ["8", "8"],
35 | ["9", "9"],
36 | ["10(SS)", "10"],
37 | ["11(MOSI)", "11"],
38 | ["12(MISO)", "12"],
39 | ["13(LED/SCK)", "13"],
40 | ["A0", "A0"],
41 | ["A1", "A1"],
42 | ["A2", "A2"],
43 | ["A3", "A3"],
44 | ["A4(SDA)", "A4"],
45 | ["A5(SCL)", "A5"]
46 | ]
47 | },
48 | "PIN_DigitalRead": {
49 | "menu": [
50 | ["2", "2"],
51 | ["0(RX)", "0"],
52 | ["1(TX)", "1"],
53 | ["3", "3"],
54 | ["4", "4"],
55 | ["5", "5"],
56 | ["6", "6"],
57 | ["7", "7"],
58 | ["8", "8"],
59 | ["9", "9"],
60 | ["10(SS)", "10"],
61 | ["11(MOSI)", "11"],
62 | ["12(MISO)", "12"],
63 | ["13(LED/SCK)", "13"],
64 | ["A0", "A0"],
65 | ["A1", "A1"],
66 | ["A2", "A2"],
67 | ["A3", "A3"],
68 | ["A4(SDA)", "A4"],
69 | ["A5(SCL)", "A5"]
70 | ]
71 | },
72 | "PINMODE":{
73 | "menu": [
74 | ["OUTPUT", "OUTPUT"],
75 | ["INPUT", "INPUT"],
76 | ["INPUT_PULLUP", "INPUT_PULLUP"]
77 | ]
78 | }
79 | }
--------------------------------------------------------------------------------
/mind+/ext-MotorDriverBoard/arduinoC/_menus/mega2560.json:
--------------------------------------------------------------------------------
1 | {
2 | "PIN_AnalogWrite": {
3 | "menu": [
4 | ["2", "2"],
5 | ["3", "3"],
6 | ["4", "4"],
7 | ["5", "5"],
8 | ["6", "6"],
9 | ["7", "7"],
10 | ["8", "8"],
11 | ["9", "9"],
12 | ["10", "10"],
13 | ["11", "11"],
14 | ["12", "12"],
15 | ["13(LED)", "13"],
16 | ["44", "44"],
17 | ["45", "45"],
18 | ["46", "46"]
19 | ]
20 | },
21 | "PIN_AnalogRead": {
22 | "menu": [
23 | ["A0", "A0"],
24 | ["A1", "A1"],
25 | ["A2", "A2"],
26 | ["A3", "A3"],
27 | ["A4", "A4"],
28 | ["A5", "A5"],
29 | ["A6", "A6"],
30 | ["A7", "A7"],
31 | ["A8", "A8"],
32 | ["A9", "A9"],
33 | ["A10", "A10"],
34 | ["A11", "A11"],
35 | ["A12", "A12"],
36 | ["A13", "A13"],
37 | ["A14", "A14"],
38 | ["A15", "A15"]
39 | ]
40 | },
41 | "PIN_DigitalWrite": {
42 | "menu": [
43 | ["2", "2"],
44 | ["0(RX)", "0"],
45 | ["1(TX)", "1"],
46 | ["3", "3"],
47 | ["4", "4"],
48 | ["5", "5"],
49 | ["6", "6"],
50 | ["7", "7"],
51 | ["8", "8"],
52 | ["9", "9"],
53 | ["10", "10"],
54 | ["11", "11"],
55 | ["12", "12"],
56 | ["13(LED)", "13"],
57 | ["14(Serial3-TX)", "14"],
58 | ["15(Serial3-RX)", "15"],
59 | ["16(Serial2-TX)", "16"],
60 | ["17(Serial2-RX)", "17"],
61 | ["18(Serial1-TX)", "18"],
62 | ["19(Serial1-RX)", "19"],
63 | ["20(SDA)", "20"],
64 | ["21(SCL)", "21"],
65 | ["22", "22"],
66 | ["23", "23"],
67 | ["24", "24"],
68 | ["25", "25"],
69 | ["26", "26"],
70 | ["27", "27"],
71 | ["28", "28"],
72 | ["29", "29"],
73 | ["30", "30"],
74 | ["31", "31"],
75 | ["32", "32"],
76 | ["33", "33"],
77 | ["34", "34"],
78 | ["35", "35"],
79 | ["36", "36"],
80 | ["37", "37"],
81 | ["38", "38"],
82 | ["39", "39"],
83 | ["40", "40"],
84 | ["41", "41"],
85 | ["42", "42"],
86 | ["43", "43"],
87 | ["44", "44"],
88 | ["45", "45"],
89 | ["46", "46"],
90 | ["47", "47"],
91 | ["48", "48"],
92 | ["49", "49"],
93 | ["50(MISO)", "50"],
94 | ["51(MOSI)", "51"],
95 | ["52(SCK)", "52"],
96 | ["53(SS)", "53"]
97 | ]
98 | },
99 | "PIN_DigitalRead": {
100 | "menu": [
101 | ["2", "2"],
102 | ["0(RX)", "0"],
103 | ["1(TX)", "1"],
104 | ["3", "3"],
105 | ["4", "4"],
106 | ["5", "5"],
107 | ["6", "6"],
108 | ["7", "7"],
109 | ["8", "8"],
110 | ["9", "9"],
111 | ["10", "10"],
112 | ["11", "11"],
113 | ["12", "12"],
114 | ["13(LED)", "13"],
115 | ["14(Serial3-TX)", "14"],
116 | ["15(Serial3-RX)", "15"],
117 | ["16(Serial2-TX)", "16"],
118 | ["17(Serial2-RX)", "17"],
119 | ["18(Serial1-TX)", "18"],
120 | ["19(Serial1-RX)", "19"],
121 | ["20(SDA)", "20"],
122 | ["21(SCL)", "21"],
123 | ["22", "22"],
124 | ["23", "23"],
125 | ["24", "24"],
126 | ["25", "25"],
127 | ["26", "26"],
128 | ["27", "27"],
129 | ["28", "28"],
130 | ["29", "29"],
131 | ["30", "30"],
132 | ["31", "31"],
133 | ["32", "32"],
134 | ["33", "33"],
135 | ["34", "34"],
136 | ["35", "35"],
137 | ["36", "36"],
138 | ["37", "37"],
139 | ["38", "38"],
140 | ["39", "39"],
141 | ["40", "40"],
142 | ["41", "41"],
143 | ["42", "42"],
144 | ["43", "43"],
145 | ["44", "44"],
146 | ["45", "45"],
147 | ["46", "46"],
148 | ["47", "47"],
149 | ["48", "48"],
150 | ["49", "49"],
151 | ["50(MISO)", "50"],
152 | ["51(MOSI)", "51"],
153 | ["52(SCK)", "52"],
154 | ["53(SS)", "53"]
155 | ]
156 | },
157 | "PINMODE":{
158 | "menu": [
159 | ["OUTPUT", "OUTPUT"],
160 | ["INPUT", "INPUT"],
161 | ["INPUT_PULLUP", "INPUT_PULLUP"]
162 | ]
163 | }
164 | }
--------------------------------------------------------------------------------
/mind+/ext-MotorDriverBoard/arduinoC/main.ts:
--------------------------------------------------------------------------------
1 | enum PINS {
2 | //% block="S1"
3 | S1,
4 | //% block="S2"
5 | S2,
6 | //% block="S3"
7 | S3,
8 | //% block="S4"
9 | S4,
10 | //% block="S5"
11 | S5,
12 | //% block="S6"
13 | S6,
14 | //% block="S7"
15 | S7,
16 | //% block="S8"
17 | S8
18 | }
19 |
20 | enum SERVOS {
21 | //% block="S1"
22 | S1 = 1,
23 | //% block="S2"
24 | S2,
25 | //% block="S3"
26 | S3,
27 | //% block="S4"
28 | S4,
29 | //% block="S5"
30 | S5,
31 | //% block="S6"
32 | S6,
33 | //% block="S7"
34 | S7,
35 | //% block="S8"
36 | S8
37 | }
38 |
39 | enum LEVELS {
40 | //% block="HIGH"
41 | HIGH,
42 | //% block="LOW"
43 | LOW
44 | }
45 |
46 | enum MOTORS {
47 | //% block="M1"
48 | M1 = 1,
49 | //% block="M2"
50 | M2,
51 | //% block="M3"
52 | M3,
53 | //% block="M4"
54 | M4
55 | }
56 |
57 | enum DIRECTIONS {
58 | //% block="FORWARD"
59 | FORWARD,
60 | //% block="BACKWARD"
61 | BACKWARD,
62 | //% block="BRAKE"
63 | BRAKE,
64 | //% block="RELEASE"
65 | RELEASE
66 | }
67 |
68 | enum STEPPER_DIRECTIONS {
69 | //% block="FORWARD"
70 | FORWARD,
71 | //% block="BACKWARD"
72 | BACKWARD
73 | }
74 |
75 | enum ENCODERS {
76 | //% block="Encoder1"
77 | Encoder1 = 1,
78 | //% block="Encoder2"
79 | Encoder2,
80 | //% block="Encoder3"
81 | Encoder3,
82 | //% block="Encoder4"
83 | Encoder4
84 | }
85 |
86 | enum STEPPERS {
87 | //% block="Stepper1"
88 | Stepper1 = 1,
89 | //% block="Stepper2"
90 | Stepper2
91 | }
92 |
93 | enum MODES {
94 | //% block="DOUBLE"
95 | DOUBLE = 1,
96 | //% block="SINGLE"
97 | SINGLE,
98 | //% block="INTERLEAVE"
99 | INTERLEAVE
100 | }
101 |
102 | //% color="#66A569" iconWidth=50 iconHeight=40
103 | namespace MotorDriverBoard {
104 |
105 | //% block="MotorDriverBoard initialization" blockType="command"
106 | export function init(parameter: any, block: any) {
107 | Generator.addInclude('Emakefun_MotorDriver', '#include', true);
108 | Generator.addObject('mMotorDriver', 'Emakefun_MotorDriver', 'mMotorDriver = Emakefun_MotorDriver(0x60);', true);
109 | Generator.addSetupMainTop('Serial.begin', 'Serial.begin(9600);', true);
110 | }
111 |
112 | //% block="set the IO frequency to [FREQ]" blockType="command"
113 | //% FREQ.shadow="range" FREQ.params.min=1 FREQ.params.max=1600 FREQ.defl=1000
114 | export function setIOFrequency(parameter: any, block: any) {
115 | let freq = parameter.FREQ.code;
116 | Generator.addSetup('mMotorDriver.begin', `mMotorDriver.begin(${freq});`, true);
117 | }
118 |
119 | //% block="set the IO [PIN] to [LEVEL]" blockType="command"
120 | //% PIN.shadow="dropdown" PIN.options="PINS" PIN.defl="PINS.S1"
121 | //% LEVEL.shadow="dropdown" LEVEL.options="LEVELS" LEVEL.defl="LEVELS.HIGH"
122 | export function setIOPinLevel(parameter: any, block: any) {
123 | let pin = parameter.PIN.code;
124 | let level = parameter.LEVEL.code;
125 | Generator.addSetup(`mMotorDriver.setIOPinLevel${pin}`, `mMotorDriver.setPin(${pin}, ${level});`, true);
126 | }
127 |
128 | //% block="set the IO [PIN] output PWM value(0-4096) [PWM]" blockType="command"
129 | //% PIN.shadow="dropdown" PIN.options="PINS" PIN.defl="PINS.S1"
130 | //% PWM.shadow="range" PWM.params.min=0 PWM.params.max=4096 PWM.defl=1024
131 | export function setIOPinPwm(parameter: any, block: any) {
132 | let pin = parameter.PIN.code;
133 | let pwm = parameter.PWM.code;
134 | Generator.addSetup(`mMotorDriver.setIOPinPwm${pin}`, `mMotorDriver.setPin(${pin}, ${pwm});`, true);
135 | }
136 |
137 | //% block="DC motor initialization [MOTOR]" blockType="command"
138 | //% MOTOR.shadow="dropdown" MOTOR.options="MOTORS" MOTOR.defl="MOTORS.M1"
139 | export function initDCMotor(parameter: any, block: any) {
140 | let motorValue = MOTORS[parameter.MOTOR.code];
141 | Generator.addObject(`mMotorDriver.DCmotor_${motorValue}`, 'Emakefun_DCMotor', `*DCmotor_${motorValue} = mMotorDriver.getMotor(${motorValue});`, true);
142 | Generator.addSetup(`mMotorDriver.begin`, `mMotorDriver.begin(150);`, true);
143 | }
144 |
145 | //% block="DC Motor [MOTOR] Direction [DIRECTION] Speed (0-255) [SPEED]" blockType="command"
146 | //% MOTOR.shadow="dropdown" MOTOR.options="MOTORS" MOTOR.defl="MOTORS.M1"
147 | //% DIRECTION.shadow="dropdown" DIRECTION.options="DIRECTIONS" DIRECTION.defl="DIRECTIONS.FORWARD"
148 | //% SPEED.shadow="range" SPEED.params.min=0 SPEED.params.max=255 SPEED.defl=0
149 | export function controlDCMotor(parameter: any, block: any) {
150 | let motorValue = MOTORS[parameter.MOTOR.code];
151 | let direction = parameter.DIRECTION.code;
152 | let speed = parameter.SPEED.code;
153 | Generator.addCode(`DCmotor_${motorValue}->run(${direction});`);
154 | Generator.addCode(`DCmotor_${motorValue}->setSpeed(${speed});`);
155 | }
156 |
157 | //% block="Stop DC motor [MOTOR]" blockType="command"
158 | //% MOTOR.shadow="dropdown" MOTOR.options="MOTORS" MOTOR.defl="MOTORS.M1"
159 | export function stopDCMotor(parameter: any, block: any) {
160 | let motorValue = MOTORS[parameter.MOTOR.code];
161 | Generator.addCode(`DCmotor_${motorValue}->run(BRAKE);`);
162 | }
163 |
164 | //% block="Encoder motor initialization [ENCODER]" blockType="command"
165 | //% ENCODER.shadow="dropdown" ENCODER.options="ENCODERS" ENCODER.defl="ENCODERS.Encoder1"
166 | export function initEncoderMotor(parameter: any, block: any) {
167 | let encoderValue = ENCODERS[parameter.ENCODER.code];
168 | Generator.addObject(`mMotorDriver.EncodeMotor_${encoderValue}`, 'Emakefun_EncoderMotor', `*EncodeMotor_${encoderValue} = mMotorDriver.getEncoderMotor(E${encoderValue});`, true);
169 | }
170 |
171 | //% block="Encoder Motor [ENCODER] Direction [DIRECTION] Speed (0-255) [SPEED]" blockType="command"
172 | //% ENCODER.shadow="dropdown" ENCODER.options="ENCODERS" ENCODER.defl="MOTORS.Encoder1"
173 | //% DIRECTION.shadow="dropdown" DIRECTION.options="DIRECTIONS" DIRECTION.defl="DIRECTIONS.FORWARD"
174 | //% SPEED.shadow="range" SPEED.params.min=0 SPEED.params.max=255 SPEED.defl=0
175 | export function controlEncoderMotor(parameter: any, block: any) {
176 | let encoderValue = ENCODERS[parameter.ENCODER.code];
177 | let direction = parameter.DIRECTION.code;
178 | let speed = parameter.SPEED.code;
179 | Generator.addCode(`EncodeMotor_${encoderValue}->run(${direction});`);
180 | Generator.addCode(`EncodeMotor_${encoderValue}->setSpeed(${speed});`);
181 | }
182 |
183 | //% block="Stop Encoder Motor [ENCODER]" blockType="command"
184 | //% ENCODER.shadow="dropdown" ENCODER.options="ENCODERS" ENCODER.defl="MOTORS.Encoder1"
185 | export function stopEncoderMotor(parameter: any, block: any) {
186 | let encoderValue = ENCODERS[parameter.ENCODER.code];
187 | Generator.addCode(`EncodeMotor_${encoderValue}->run(BRAKE);`);
188 | }
189 |
190 | //% block="Stepper motor initialization [STEPPER] Number of steps (steps/lap) [STEP] Revolutions per minute [LAP]" blockType="command"
191 | //% STEPPER.shadow="dropdown" STEPPER.options="STEPPERS" STEPPER.defl="STEPPERS.Stepper1"
192 | //% STEP.shadow="range" STEP.params.min=0 STEP.params.max=255 STEP.defl=100
193 | //% LAP.shadow="range" LAP.params.min=0 LAP.params.max=255 LAP.defl=200
194 | export function initStepperMotor(parameter: any, block: any) {
195 | let stepperValue = STEPPERS[parameter.STEPPER.code];
196 | let step = parameter.STEP.code;
197 | let lap = parameter.LAP.code;
198 | Generator.addObject(`mMotorDriver.StepperMotor_${stepperValue}`, 'Emakefun_StepperMotor', `*StepperMotor_${stepperValue} = mMotorDriver.getStepper(${stepperValue}, ${step});`, true);
199 | Generator.addCode(`StepperMotor_${stepperValue}->setSpeed(${lap});`);
200 | }
201 |
202 | //% block="Stepper motor [STEPPER] Direction [DIRECTION] Drive mode (half-step/single-step) [MODE] Number of steps [STEP]" blockType="command"
203 | //% STEPPER.shadow="dropdown" STEPPER.options="STEPPERS" STEPPER.defl="STEPPERS.Stepper1"
204 | //% DIRECTION.shadow="dropdown" DIRECTION.options="STEPPER_DIRECTIONS" DIRECTION.defl="STEPPER_DIRECTIONS.FORWARD"
205 | //% MODE.shadow="dropdown" MODE.options="MODES" MODE.defl="MODES.DOUBLE"
206 | //% STEP.shadow="range" STEP.params.min=0 STEP.params.max=255 STEP.defl=100
207 | export function controlStepperMotor(parameter: any, block: any) {
208 | let stepperValue = STEPPERS[parameter.STEPPER.code];
209 | let direction = parameter.DIRECTION.code;
210 | let mode = parameter.MODE.code;
211 | let step = parameter.STEP.code;
212 | Generator.addCode(`StepperMotor_${stepperValue}->step(${step}, ${direction}, ${mode});`);
213 | }
214 |
215 | //% block="Stop stepper motor [STEPPER]" blockType="command"
216 | //% STEPPER.shadow="dropdown" STEPPER.options="STEPPERS" STEPPER.defl="STEPPERS.Stepper1"
217 | export function stopStepperMotor(parameter: any, block: any) {
218 | let stepperValue = STEPPERS[parameter.STEPPER.code];
219 | Generator.addCode(`StepperMotor_${stepperValue}->release();`);
220 | }
221 |
222 | //% block="Servo initialization interface [SERVO]" blockType="command"
223 | //% SERVO.shadow="dropdown" SERVO.options="SERVOS" SERVO.defl="SERVOS.S1"
224 | export function initServoMotor(parameter: any, block: any) {
225 | let servoValue = SERVOS[parameter.SERVO.code];
226 | Generator.addObject(`mMotorDriver.servo${servoValue}`, 'Emakefun_Servo', `*servo${servoValue} = mMotorDriver.getServo(${servoValue});`, true);
227 | Generator.addSetup(`mMotorDriver.begin`, `mMotorDriver.begin(50);`, true);
228 | }
229 |
230 | //% block="The servo interface [SERVO] reads the current servo angle" blockType="command"
231 | //% SERVO.shadow="dropdown" SERVO.options="SERVOS" SERVO.defl="SERVOS.S1"
232 | export function readServoMotorAngle(parameter: any, block: any) {
233 | let servoValue = SERVOS[parameter.SERVO.code];
234 | Generator.addCode(`servo${servoValue}->readDegrees();`);
235 | }
236 |
237 | //% block="Servo Interface [SERVO] Angle [ANGLE] Speed(0-100) [SPEED]" blockType="command"
238 | //% SERVO.shadow="dropdown" SERVO.options="SERVOS" SERVO.defl="SERVOS.S1"
239 | //% ANGLE.shadow="range" ANGLE.params.min=0 ANGLE.params.max=180 ANGLE.defl=90
240 | //% SPEED.shadow="range" SPEED.params.min=0 SPEED.params.max=10 SPEED.defl=10
241 | export function controlServoMotor(parameter: any, block: any) {
242 | let servoValue = SERVOS[parameter.SERVO.code];
243 | let angle = parameter.ANGLE.code;
244 | let speed = parameter.SPEED.code;
245 | Generator.addCode(`servo${servoValue}->writeServo(${angle}, ${speed});`);
246 | }
247 |
248 | }
249 |
--------------------------------------------------------------------------------
/mind+/ext-MotorDriverBoard/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": {
3 | "zh-cn": "电机驱动板",
4 | "en": "MotorDriverBoard"
5 | },
6 | "description": {
7 | "zh-cn": "专门针对Arduino Uno(兼容Mega2560)机器人,电机驱动,多路舵机控制而研发的一款多功能电机驱动扩展板。",
8 | "en": "Specially for Arduino Uno (compatible with Mega2560) robot, motor drive, and multi-channel servo control."
9 | },
10 | "author": "emakefun",
11 | "email": "ken@emakefun.com",
12 | "license": "MIT",
13 | "isBoard": false,
14 | "id": "MotorDriverBoard",
15 | "platform": ["win", "mac", "web"],
16 | "version": "0.0.3",
17 | "asset": {
18 | "arduinoC": {
19 | "dir": "arduinoC/",
20 | "version": "0.0.1",
21 | "board": ["arduino", "mega2560"],
22 | "main": "main.ts"
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/mixly/MotorDriverBoard.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 1000
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | 1024
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 0
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 0
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | 100
55 |
56 |
57 |
58 |
59 | 200
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | 100
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | 90
81 |
82 |
83 |
84 |
85 | 10
86 |
87 |
88 |
89 |
90 |
91 |
98 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/mixly/language/MotorDriverBoard/en.js:
--------------------------------------------------------------------------------
1 | //图形块名称翻译
2 | Blockly.MOTORDRIVERBOARD_SETUP = "MotorDriverBoard Initialization";
3 | Blockly.MOTORDRIVERBOARD_DCMOTOR = "DC Motor Interface";
4 | Blockly.MOTORDRIVERBOARD_DCDIRECTIONS = "direction";
5 | Blockly.MOTORDRIVERBOARD_SPEED = "speed";
6 | Blockly.MOTORDRIVERBOARD_DCPORTS_FIRST = "Interface 1";
7 | Blockly.MOTORDRIVERBOARD_DCPORTS_SECOND = "Interface 2";
8 | Blockly.MOTORDRIVERBOARD_DCPORTS_THIRD = "Interface 3";
9 | Blockly.MOTORDRIVERBOARD_DCPORTS_FOURTH = "Interface 4";
10 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_FORWARD = "Positive rotation";
11 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_BACK = "Reversal";
12 | Blockly.MOTORDRIVERBOARD_STOPDCMOTOR = "Stop DC motor";
13 | Blockly.MOTORDRIVERBOARD_ENMOTOR = "Coded Motor Interface";
14 | Blockly.MOTORDRIVERBOARD_ENPORTS_FIRST = "Interface 1";
15 | Blockly.MOTORDRIVERBOARD_ENPORTS_SECOND = "Interface 2";
16 | Blockly.MOTORDRIVERBOARD_ENPORTS_THIRD = "Interface 3";
17 | Blockly.MOTORDRIVERBOARD_ENPORTS_FOURTH = "Interface 4";
18 | Blockly.MOTORDRIVERBOARD_ENDIRECTIONS = "direction";
19 | Blockly.MOTORDRIVERBOARD_ENDIRECTION_FORWARD = "Positive rotation";
20 | Blockly.MOTORDRIVERBOARD_ENDIRECTION_BACK = "Reversal";
21 | Blockly.MOTORDRIVERBOARD_STOPENMOTOR = "Stop coding motor";
22 | Blockly.MOTORDRIVERBOARD_STMOTOR = "Stepping Motor Interface";
23 | Blockly.MOTORDRIVERBOARD_STDIRECTIONS = "direction";
24 | Blockly.MOTORDRIVERBOARD_STEPS = "Step number";
25 | Blockly.MOTORDRIVERBOARD_STPORTS_FIRST = "Interface 1";
26 | Blockly.MOTORDRIVERBOARD_STPORTS_SECOND = "Interface 2";
27 | Blockly.MOTORDRIVERBOARD_STDIRECTION_FORWARD = "Positive rotation";
28 | Blockly.MOTORDRIVERBOARD_STDIRECTION_BACK = "Reversal";
29 | //Blockly.MOTORDRIVERBOARD_STSTYLES = "Style";
30 | //Blockly.MOTORDRIVERBOARD_STYLE_SINGLE = "single";
31 | //Blockly.MOTORDRIVERBOARD_STYLE_DOUBLE = "double";
32 | //Blockly.MOTORDRIVERBOARD_STYLE_INTERLEAVE = "staggered";
33 | //Blockly.MOTORDRIVERBOARD_STYLE_MICROSTEP = "Micro step";
34 | //Blockly.MOTORDRIVERBOARD_SETRGB = "RGB lamp";
35 | Blockly.MOTORDRIVERBOARD_RGBCOLOUR = "colour";
36 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_ALL = "all";
37 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_LEFT = "left";
38 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_RIGHT = "Right";
39 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_RED = "red";
40 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_GREEN = "green";
41 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_BLUE = "blue";
42 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_YELLOW = "yellow";
43 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_PURPLE = "purple";
44 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_WHITE = "white";
45 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_OFF = "Extinguish";
46 | Blockly.MOTORDRIVERBOARD_PLAYSOUNDS = "Play sound";
47 | Blockly.MOTORDRIVERBOARD_SOUNDS_CONNECTED = "Connect";
48 | Blockly.MOTORDRIVERBOARD_SOUNDS_DISCONNECTED = "Disconnect";
49 | Blockly.MOTORDRIVERBOARD_SOUNDS_BUTTONPUSHED = "Button press";
50 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE1 = "Mode 1";
51 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE2 = "Mode 2";
52 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE3 = "Mode 3";
53 | Blockly.MOTORDRIVERBOARD_SOUNDS_SURPRISE = "surprised";
54 | Blockly.MOTORDRIVERBOARD_SOUNDS_OHOH = "oh";
55 | Blockly.MOTORDRIVERBOARD_SOUNDS_OHOH2 = "ohoh";
56 | Blockly.MOTORDRIVERBOARD_SOUNDS_CUDDLY = "cuddly";
57 | Blockly.MOTORDRIVERBOARD_SOUNDS_SLEEPING = "sleeping";
58 | Blockly.MOTORDRIVERBOARD_SOUNDS_HAPPY = "happy";
59 | Blockly.MOTORDRIVERBOARD_SOUNDS_SUPERHAPPY = "superhappy";
60 | Blockly.MOTORDRIVERBOARD_SOUNDS_SHORTHAPPY = "shorthappy";
61 | Blockly.MOTORDRIVERBOARD_SOUNDS_SAD = "sad";
62 | Blockly.MOTORDRIVERBOARD_SOUNDS_CONFUSED = "sonfused";
63 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART1 = "fart 1";
64 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART2 = "fart 2";
65 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART3 = "fart 3";
66 | Blockly.MOTORDRIVERBOARD_INITULTRASONIC = "Ultrasound Initialization";
67 | Blockly.MOTORDRIVERBOARD_READULTRASONICDISTANCE = "Reading Ultrasound Distance";
68 | Blockly.MOTORDRIVERBOARD_INITIRREMOTE = "Initialization of Infrared Receiving";
69 | Blockly.MOTORDRIVERBOARD_IFIRREMOTEPRESSED = "Ir key press";
70 | Blockly.MOTORDRIVERBOARD_IRKEYPRESS = "emakefun Infrared remote control key press";
71 | Blockly.MOTORDRIVERBOARD_IRKEYPRESS = "ordinary Infrared remote control key press";
72 | Blockly.MOTORDRIVERBOARD_IRKEY_UP = "up";
73 | Blockly.MOTORDRIVERBOARD_IRKEY_DOWN = "down";
74 | Blockly.MOTORDRIVERBOARD_IRKEY_LEFT = "left";
75 | Blockly.MOTORDRIVERBOARD_IRKEY_RIGHT = "right";
76 | Blockly.MOTORDRIVERBOARD_INITNRF24L01 = "NRF24L01 initialization";
77 | Blockly.MOTORDRIVERBOARD_INITNRF24L01SENDDATA = "NRF24L01 sends data";
78 | Blockly.MOTORDRIVERBOARD_INITNRF24L01ADDRESS = "address";
79 | Blockly.MOTORDRIVERBOARD_INITNRF24L01DATA = "data";
80 | Blockly.MOTORDRIVERBOARD_INITNRF24L01RECEIVEDATA = "NRF24L01 receive data";
81 | Blockly.MOTORDRIVERBOARD_INITNRF24L01ISNOTNULL = "NRF24L01 data is not empty";
82 | Blockly.MOTORDRIVERBOARD_GETINITNRF24L01 = "Getting NRF24L01 data";
83 | Blockly.MOTORDRIVERBOARD_PS2INIT = "PS2 Initialization";
84 | Blockly.MOTORDRIVERBOARD_WHICHPS2KEYPRESSED = "PS2 key pressed";
85 | Blockly.MOTORDRIVERBOARD_SETPS2VIBRATE = "Setting Ps2 Rocker Vibration Value";
86 | Blockly.MOTORDRIVERBOARD_PS2KEYPRESS = "PS2 handle press";
87 | Blockly.MOTORDRIVERBOARD_PS2KEYS_UP = "up";
88 | Blockly.MOTORDRIVERBOARD_PS2KEYS_DOWN = "down";
89 | Blockly.MOTORDRIVERBOARD_PS2KEYS_LEFT = "left";
90 | Blockly.MOTORDRIVERBOARD_PS2KEYS_RIGHT = "right";
91 | Blockly.MOTORDRIVERBOARD_PS2KEYS_TRIANGLE = "△";
92 | Blockly.MOTORDRIVERBOARD_PS2KEYS_CIRCLE = "○";
93 | Blockly.MOTORDRIVERBOARD_PS2KEYS_CROSS = "×";
94 | Blockly.MOTORDRIVERBOARD_PS2KEYS_SQUARE = "囗";
95 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L1 = "Left 1";
96 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L2 = "Left 2";
97 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L3 = "Left 3";
98 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R1 = "Right 1";
99 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R2 = "Right 2";
100 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R3 = "Right 3";
101 | Blockly.MOTORDRIVERBOARD_PS2KEYS_SELECT = "select";
102 | Blockly.MOTORDRIVERBOARD_PS2KEYS_START = "start";
103 | Blockly.MOTORDRIVERBOARD_PS2KEYUNPRESS = "ps2 loosened";
104 | Blockly.MOTORDRIVERBOARD_PS2GETVIBRATE = "Getting Rocker Value";
105 | Blockly.MOTORDRIVERBOARD_PS2GETVIBRATE2 = "Get rocker angle";
106 | Blockly.MOTORDRIVERBOARD_VIBRATE2_L = "Left rocker";
107 | Blockly.MOTORDRIVERBOARD_VIBRATE2_R = "Right rocker";
108 | Blockly.MOTORDRIVERBOARD_VIBRATE_LX = "Left lateral axis";
109 | Blockly.MOTORDRIVERBOARD_VIBRATE_LY = "Left vertical axis";
110 | Blockly.MOTORDRIVERBOARD_VIBRATE_RX = "Right horizontal axis";
111 | Blockly.MOTORDRIVERBOARD_VIBRATE_RY = "Right vertical axis";
112 | Blockly.MOTORDRIVERBOARD_PS2STATUS = "Read PS2 status";
113 | Blockly.MOTORDRIVERBOARD_SERVOPORT = "Steering gear interface";
114 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FIRST = "Interface 1";
115 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SECOND = "Interface 2";
116 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_THIRD = "Interface 3";
117 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FOURTH = "Interface 4";
118 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FIVETH = "Interface 5";
119 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SIXTH = "Interface 6";
120 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SEVENTH = "Interface 7";
121 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_EIGHTH = "Interface 8";
122 | Blockly.MOTORDRIVERBOARD_ANGLE = "angle";
123 | Blockly.MOTORDRIVERBOARD_RED = "red";
124 | Blockly.MOTORDRIVERBOARD_GREEN = "green";
125 | Blockly.MOTORDRIVERBOARD_BLUE = "blue";
126 | Blockly.MOTORDRIVERBOARD_READDEGEREES = "Read the current steering angle";
127 |
128 | Blockly.MOTORDRIVERBOARD_INITDCMOTOR = "DC motor initialization";
129 | Blockly.MOTORDRIVERBOARD_INITENMOTOR = "Code motor initialization";
130 | Blockly.MOTORDRIVERBOARD_INITSTMOTOR = "Stepper motor initialization";
131 | Blockly.MOTORDRIVERBOARD_INITRGB = "RGB initialization";
132 | Blockly.MOTORDRIVERBOARD_INITSOUNDS = "Buzzer initialization";
133 | Blockly.MOTORDRIVERBOARD_INITSERVO = "Servo initialization Interface";
134 |
135 | Blockly.MOTORDRIVERBOARD_M4INIT = "4WD initialization Motor Interface";
136 | Blockly.MOTORDRIVERBOARD_LEFTFORWARD = "Left front";
137 | Blockly.MOTORDRIVERBOARD_RIGHTFORWARD = "Right front";
138 | Blockly.MOTORDRIVERBOARD_LEFTBACKWARD = "Left rear";
139 | Blockly.MOTORDRIVERBOARD_RIGHTBACKWARD = "Right rear";
140 | Blockly.MOTORDRIVERBOARD_M4GOFORWARD = "4WD car forward speed";
141 | Blockly.MOTORDRIVERBOARD_M4BACKFORWARD = "4WD car back speed";
142 | Blockly.MOTORDRIVERBOARD_M4TURNLEFT = "4WD car turn left speed";
143 | Blockly.MOTORDRIVERBOARD_M4TURNRIGHT = "4WD car turn right speed";
144 | Blockly.MOTORDRIVERBOARD_M4TURNLEFTS = "4WD car Left spin speed";
145 | Blockly.MOTORDRIVERBOARD_M4TURNRIGHTS = "4WD car Right spin speed";
146 | Blockly.MOTORDRIVERBOARD_M4GODEGREE = "4WD car Driving angle";
147 | Blockly.MOTORDRIVERBOARD_M4GOSPEED = "speed";
148 | Blockly.MOTORDRIVERBOARD_M4STOP = "4WD car stop";
149 | Blockly.MOTORDRIVERBOARD_BLUETOOTHINIT = "Bluetooth initialization";
150 | Blockly.MOTORDRIVERBOARD_RECEIVEDATA = "Receive Bluetooth data";
151 | Blockly.MOTORDRIVERBOARD_RECEIVEDDDATA = "Bluetooth data received";
152 | Blockly.MOTORDRIVERBOARD_BLUETOOTHPRESS = "Bluetooth operation key press";
153 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE = "Bluetooth data type";
154 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_BUTTONS = "Key";
155 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_DIRECTIONS = "angle";
156 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_SPEEDS = "speed";
157 | Blockly.MOTORDRIVERBOARD_BLUETOOTHGETDEGREE = "Bluetooth acquisition angle";
158 |
159 | Blockly.MOTORDRIVERBOARD_BLUETOOTHGETSPEED = "Speed of Bluetooth acquisition";
160 | Blockly.MOTORDRIVERBOARD_NRFINIT = "NRF24L01 + initialization address";
161 | Blockly.MOTORDRIVERBOARD_NRFDATAREADY = "nRF24L01+Data received";
162 | Blockly.MOTORDRIVERBOARD_NRFVALUE = "Define an array to receive NRF data";
163 | Blockly.MOTORDRIVERBOARD_NRFGETDATA = "Read nRF24L01 + data";
164 | Blockly.MOTORDRIVERBOARD_NRFGETPACKAGE = "Receive and read nRF24L01 + wireless handle data";
165 | Blockly.MOTORDRIVERBOARD_NRFNEWOB = "Create NRF data type object";
166 | Blockly.MOTORDRIVERBOARD_NRFDATAFUN = "Get the data type of nRF24L01 + wireless handle received and read";
167 | Blockly.MOTORDRIVERBOARD_NRFDIRECTION = "direction";
168 | Blockly.MOTORDRIVERBOARD_NRFSPEED = "speed";
169 | Blockly.MOTORDRIVERBOARD_NRFBUTTON = "Key";
170 | Blockly.MOTORDRIVERBOARD_NRFBUTTONS = "Wireless handle key press";
171 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSL1 = "left1";
172 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSR1 = "right1";
173 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSUP = "up";
174 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSDOWN = "down";
175 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSLEFT = "left";
176 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSRIGHT = "right";
177 | Blockly.MOTORDRIVERBOARD_NRFGETDEGREE = "nRF24L01+ get angle";
178 | Blockly.MOTORDRIVERBOARD_NRFGETSPEED = "nRF24L01+ get speed";
179 | Blockly.MOTORDRIVERBOARD_SETRGBBRIGHTNESS = "Set RGB light brightness(0~255)";
--------------------------------------------------------------------------------
/mixly/language/MotorDriverBoard/zh-hans.js:
--------------------------------------------------------------------------------
1 | //图形块名称翻译
2 | Blockly.MOTORDRIVERBOARD_QRCODE = "Github学习教程",
3 | BASE_MODEL = "基础模块",
4 | Blockly.MOTORDRIVERBOARD_SETUP = "MotorDriverBoard初始化";
5 | Blockly.MOTORDRIVERBOARD_DCMOTOR = "直流电机";
6 | Blockly.MOTORDRIVERBOARD_DCDIRECTIONS = "方向";
7 | Blockly.MOTORDRIVERBOARD_SPEED = "速度(0-10)";
8 | Blockly.MOTORDRIVERBOARD_DCPORTS_FIRST = "M1";
9 | Blockly.MOTORDRIVERBOARD_DCPORTS_SECOND = "M2";
10 | Blockly.MOTORDRIVERBOARD_DCPORTS_THIRD = "M3";
11 | Blockly.MOTORDRIVERBOARD_DCPORTS_FOURTH = "M4";
12 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_FORWARD = "正转";
13 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_BACK = "反转";
14 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_BRAKE = "刹车";
15 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_RELEASE = "释放";
16 | Blockly.MOTORDRIVERBOARD_STOPDCMOTOR = "停止直流电机";
17 | Blockly.MOTORDRIVERBOARD_ENMOTOR = "编码电机";
18 | Blockly.MOTORDRIVERBOARD_ENPORTS_FIRST = "Encoder1";
19 | Blockly.MOTORDRIVERBOARD_ENPORTS_SECOND = "Encoder2";
20 | Blockly.MOTORDRIVERBOARD_ENPORTS_THIRD = "Encoder3";
21 | Blockly.MOTORDRIVERBOARD_ENPORTS_FOURTH = "Encoder4";
22 | Blockly.MOTORDRIVERBOARD_ENDIRECTIONS = "方向";
23 | Blockly.MOTORDRIVERBOARD_ENDIMODE = "驱动方式";
24 | Blockly.MOTORDRIVERBOARD_ENDIRECTION_FORWARD = "正转";
25 | Blockly.MOTORDRIVERBOARD_ENDIRECTION_BACK = "反转";
26 | Blockly.MOTORDRIVERBOARD_ENDIRECTION_BRAKE = "停止";
27 | Blockly.MOTORDRIVERBOARD_STEP = "步数";
28 | Blockly.MOTORDRIVERBOARD_STOPENMOTOR = "停止编码电机";
29 | Blockly.MOTORDRIVERBOARD_STMOTOR = "步进电机";
30 | Blockly.MOTORDRIVERBOARD_STDIRECTIONS = "方向";
31 | Blockly.MOTORDRIVERBOARD_STEPS = "步数(步/圈)";
32 | Blockly.MOTORDRIVERBOARD_STEPS1 = "运动步数";
33 | Blockly.MOTORDRIVERBOARD_STPORTS_FIRST = "Stepper1";
34 | Blockly.MOTORDRIVERBOARD_STPORTS_SECOND = "Stepper2";
35 | Blockly.MOTORDRIVERBOARD_STDIRECTION_FORWARD = "正转";
36 | Blockly.MOTORDRIVERBOARD_STDIRECTION_BACK = "反转";
37 | Blockly.MOTORDRIVERBOARD_STOPSTMOTOR = "停止步进电机";
38 | Blockly.MOTORDRIVERBOARD_STDOUBLESINGLE = "驱动方式(半步/单步)";
39 | Blockly.MOTORDRIVERBOARD_STSINGLE = "单步";
40 | Blockly.MOTORDRIVERBOARD_STDOUBLE = "全步";
41 | Blockly.MOTORDRIVERBOARD_INTERLEAVE = "半步";
42 | Blockly.MOTORDRIVERBOARD_MINFREQ = "每分钟转的圈数";
43 | //Blockly.MOTORDRIVERBOARD_STYLE_INTERLEAVE = "交错";
44 | //Blockly.MOTORDRIVERBOARD_STYLE_MICROSTEP = "微步";
45 | Blockly.MOTORDRIVERBOARD_SETRGB = "RGB灯";
46 | Blockly.MOTORDRIVERBOARD_RGBCOLOUR = "颜色";
47 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_ALL = "全部";
48 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_LEFT = "左边";
49 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_RIGHT = "右边";
50 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_RED = "红色";
51 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_GREEN = "绿色";
52 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_BLUE = "蓝色";
53 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_YELLOW = "黄色";
54 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_PURPLE = "紫色";
55 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_WHITE = "白色";
56 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_OFF = "熄灭";
57 | Blockly.MOTORDRIVERBOARD_PLAYSOUNDS = "播放声音";
58 | Blockly.MOTORDRIVERBOARD_SOUNDS_CONNECTED = "连接";
59 | Blockly.MOTORDRIVERBOARD_SOUNDS_DISCONNECTED = "断开连接";
60 | Blockly.MOTORDRIVERBOARD_SOUNDS_BUTTONPUSHED = "按钮按下";
61 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE1 = "模式一";
62 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE2 = "模式二";
63 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE3 = "模式三";
64 | Blockly.MOTORDRIVERBOARD_SOUNDS_SURPRISE = "惊讶";
65 | Blockly.MOTORDRIVERBOARD_SOUNDS_OHOH = "哦";
66 | Blockly.MOTORDRIVERBOARD_SOUNDS_OHOH2 = "哦哦";
67 | Blockly.MOTORDRIVERBOARD_SOUNDS_CUDDLY = "可爱";
68 | Blockly.MOTORDRIVERBOARD_SOUNDS_SLEEPING = "困倦";
69 | Blockly.MOTORDRIVERBOARD_SOUNDS_HAPPY = "高兴";
70 | Blockly.MOTORDRIVERBOARD_SOUNDS_SUPERHAPPY = "超级高兴";
71 | Blockly.MOTORDRIVERBOARD_SOUNDS_SHORTHAPPY = "短暂高兴";
72 | Blockly.MOTORDRIVERBOARD_SOUNDS_SAD = "悲伤";
73 | Blockly.MOTORDRIVERBOARD_SOUNDS_CONFUSED = "困惑";
74 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART1 = "讨厌一";
75 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART2 = "讨厌二";
76 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART3 = "讨厌三";
77 | Blockly.MOTORDRIVERBOARD_SOUNDS_DIDI = "滴滴",
78 | Blockly.MOTORDRIVERBOARD_INITULTRASONIC = "超声波初始化";
79 | Blockly.MOTORDRIVERBOARD_READULTRASONICDISTANCE = "读取超声波距离";
80 | Blockly.MOTORDRIVERBOARD_INITIRREMOTE = "红外接收初始化";
81 | Blockly.MOTORDRIVERBOARD_IFIRREMOTEPRESSED = "红外遥控器按键被按下";
82 | Blockly.MOTORDRIVERBOARD_IRKEYPRESS = "emakefun红外遥控器按键按下";
83 | Blockly.MOTORDRIVERBOARD_IRKEYPRESS2 = "普通红外遥控器按键按下";
84 | Blockly.MOTORDRIVERBOARD_IRKEY_UP = "上";
85 | Blockly.MOTORDRIVERBOARD_IRKEY_DOWN = "下";
86 | Blockly.MOTORDRIVERBOARD_IRKEY_LEFT = "左";
87 | Blockly.MOTORDRIVERBOARD_IRKEY_RIGHT = "右";
88 | Blockly.MOTORDRIVERBOARD_INITNRF24L01 = "NRF24L01初始化";
89 |
90 | Blockly.MOTORDRIVERBOARD_INITNRF24L01ADDRESS = "接收地址";
91 |
92 | Blockly.MOTORDRIVERBOARD_INITNRF24L01RECEIVEDATA = "串口打印NRF24L01接收的数据";
93 | Blockly.MOTORDRIVERBOARD_INITNRF24L01ISNOTNULL = "NRF24L01数据不为空";
94 | Blockly.MOTORDRIVERBOARD_GETINITNRF24L01 = "获取NRF24L01数据";
95 | Blockly.MOTORDRIVERBOARD_PS2INIT = "PS2手柄初始化";
96 | Blockly.MOTORDRIVERBOARD_PS2GETVALUE = "读取PS2状态";
97 | Blockly.MOTORDRIVERBOARD_WHICHPS2KEYPRESSED = "PS2键被按下";
98 | Blockly.MOTORDRIVERBOARD_SETPS2VIBRATE = "设置ps2摇杆震动值";
99 | Blockly.MOTORDRIVERBOARD_PS2KEYPRESS = "ps2手柄按键";
100 | Blockly.MOTORDRIVERBOARD_PS2KEYS_UP = "上";
101 | Blockly.MOTORDRIVERBOARD_PS2KEYS_DOWN = "下";
102 | Blockly.MOTORDRIVERBOARD_PS2KEYS_LEFT = "左";
103 | Blockly.MOTORDRIVERBOARD_PS2KEYS_RIGHT = "右";
104 | Blockly.MOTORDRIVERBOARD_PS2KEYS_TRIANGLE = "△";
105 | Blockly.MOTORDRIVERBOARD_PS2KEYS_CIRCLE = "○";
106 | Blockly.MOTORDRIVERBOARD_PS2KEYS_CROSS = "×";
107 | Blockly.MOTORDRIVERBOARD_PS2KEYS_SQUARE = "囗";
108 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L1 = "左1";
109 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L2 = "左2";
110 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L3 = "左3";
111 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R1 = "右1";
112 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R2 = "右2";
113 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R3 = "右3";
114 | Blockly.MOTORDRIVERBOARD_PS2KEYS_SELECT = "选择";
115 | Blockly.MOTORDRIVERBOARD_PS2KEYS_START = "开始";
116 | Blockly.MOTORDRIVERBOARD_PS2KEYUNPRESS = "ps2手柄松开";
117 | Blockly.MOTORDRIVERBOARD_PS2GETVIBRATE = "获取摇杆值";
118 | Blockly.MOTORDRIVERBOARD_PS2GETVIBRATE2 = "获取摇杆角度";
119 | Blockly.MOTORDRIVERBOARD_VIBRATE2_L = "左摇杆";
120 | Blockly.MOTORDRIVERBOARD_VIBRATE2_R = "右摇杆";
121 | Blockly.MOTORDRIVERBOARD_VIBRATE_LX = "左横轴";
122 | Blockly.MOTORDRIVERBOARD_VIBRATE_LY = "左纵轴";
123 | Blockly.MOTORDRIVERBOARD_VIBRATE_RX = "右横轴";
124 | Blockly.MOTORDRIVERBOARD_VIBRATE_RY = "右纵轴";
125 | Blockly.MOTORDRIVERBOARD_PS2STATUS = "读取ps2状态";
126 | Blockly.MOTORDRIVERBOARD_SERVOPORT = "舵机接口";
127 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FIRST = "S1";
128 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SECOND = "S2";
129 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_THIRD = "S3";
130 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FOURTH = "S4";
131 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FIVETH = "S5";
132 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SIXTH = "S6";
133 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SEVENTH = "S7";
134 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_EIGHTH = "S8";
135 | Blockly.MOTORDRIVERBOARD_ANGLE = "角度";
136 | Blockly.MOTORDRIVERBOARD_RED = "红";
137 | Blockly.MOTORDRIVERBOARD_GREEN = "绿";
138 | Blockly.MOTORDRIVERBOARD_BLUE = "蓝";
139 | Blockly.MOTORDRIVERBOARD_READDEGEREES = "读取当前舵机角度";
140 | Blockly.MOTORDRIVERBOARD_INITDCMOTOR = "直流电机初始化";
141 | Blockly.MOTORDRIVERBOARD_INITENMOTOR = "编码电机初始化";
142 | Blockly.MOTORDRIVERBOARD_INITSTMOTOR = "步进电机初始化";
143 | Blockly.MOTORDRIVERBOARD_INITRGB = "RGB灯初始化";
144 | Blockly.MOTORDRIVERBOARD_INITSOUNDS = "蜂鸣器初始化";
145 | Blockly.MOTORDRIVERBOARD_INITSERVO = "舵机初始化 接口";
146 |
147 | Blockly.MOTORDRIVERBOARD_M4INIT = "四驱车初始化电机接口";
148 | Blockly.MOTORDRIVERBOARD_LEFTFORWARD = "左前";
149 | Blockly.MOTORDRIVERBOARD_RIGHTFORWARD = "右前";
150 | Blockly.MOTORDRIVERBOARD_LEFTBACKWARD = "左后";
151 | Blockly.MOTORDRIVERBOARD_RIGHTBACKWARD = "右后";
152 | Blockly.MOTORDRIVERBOARD_M4GOFORWARD = "四驱车前进 速度";
153 | Blockly.MOTORDRIVERBOARD_M4BACKFORWARD = "四驱车后退 速度";
154 | Blockly.MOTORDRIVERBOARD_M4TURNLEFT = "四驱车左转 速度";
155 | Blockly.MOTORDRIVERBOARD_M4TURNRIGHT = "四驱车右转 速度";
156 | Blockly.MOTORDRIVERBOARD_M4TURNLEFTS = "四驱车左自旋 速度";
157 | Blockly.MOTORDRIVERBOARD_M4TURNRIGHTS = "四驱车右自旋 速度";
158 | Blockly.MOTORDRIVERBOARD_M4GODEGREE = "四驱车行驶角度";
159 | Blockly.MOTORDRIVERBOARD_M4GOSPEED = "速度";
160 | Blockly.MOTORDRIVERBOARD_M4STOP = "四驱车停止";
161 | Blockly.MOTORDRIVERBOARD_BLUETOOTHINIT = "蓝牙初始化";
162 | Blockly.MOTORDRIVERBOARD_RECEIVEDATA = "接收蓝牙数据";
163 | Blockly.MOTORDRIVERBOARD_RECEIVEDDDATA = "接收到了蓝牙数据";
164 | Blockly.MOTORDRIVERBOARD_BLUETOOTHPRESS = "蓝牙操作键按下";
165 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE = "蓝牙数据类型";
166 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_BUTTONS = "按键";
167 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_DIRECTIONS = "角度";
168 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_SPEEDS = "速度";
169 | Blockly.MOTORDRIVERBOARD_BLUETOOTHGETDEGREE = "蓝牙获取的角度";
170 | Blockly.MOTORDRIVERBOARD_BLUETOOTHGETSPEED = "蓝牙获取的速度";
171 | Blockly.MOTORDRIVERBOARD_NRFINIT = "nRF24L01+初始化 地址";
172 | Blockly.MOTORDRIVERBOARD_NRFDATAREADY = "nRF24L01+接收到数据";
173 | Blockly.MOTORDRIVERBOARD_NRFVALUE = "定义接收nrf数据的数组";
174 | Blockly.MOTORDRIVERBOARD_NRFGETDATA = "读取nRF24L01+数据";
175 | Blockly.MOTORDRIVERBOARD_NRFGETPACKAGE = "收到读取nRF24L01+无线手柄数据";
176 | Blockly.MOTORDRIVERBOARD_NRFNEWOB = "创建nrf数据类型对象";
177 | Blockly.MOTORDRIVERBOARD_NRFDATAFUN = "获取收到读取nRF24L01+无线手柄数据类型";
178 | Blockly.MOTORDRIVERBOARD_NRFDIRECTION = "方向";
179 | Blockly.MOTORDRIVERBOARD_NRFSPEED = "速度(0-10)";
180 | Blockly.MOTORDRIVERBOARD_NRFBUTTON = "按键";
181 | Blockly.MOTORDRIVERBOARD_NRFBUTTONS = "无线手柄按键按下";
182 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSL1 = "左1";
183 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSR1 = "右1";
184 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSUP = "上";
185 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSDOWN = "下";
186 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSLEFT = "左";
187 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSRIGHT = "右";
188 | Blockly.MOTORDRIVERBOARD_NRFGETDEGREE = "获取nRF24L01+无线手柄角度";
189 | Blockly.MOTORDRIVERBOARD_NRFGETSPEED = "获取nRF24L01+无线手柄速度";
190 | Blockly.MOTORDRIVERBOARD_SETRGBBRIGHTNESS = "设置RGB灯亮度(0~255)";
191 | Blockly.MOTORDRIVERBOARD_RGBBRIGHTNESSS = "亮度(0~255)";
192 | Blockly.MOTORDRIVERBOARD_INITNRF24L01SENDDATA = "初始化nRF24L01+";
193 | Blockly.MOTORDRIVERBOARD_INITNRF24L01CHANNEL = "频道";
194 | Blockly.MOTORDRIVERBOARD_INITNRF24L01DATA = "发送数组";
195 | Blockly.MOTORDRIVERBOARD_INITNRF24L01DATA2 = "接收数组";
196 | Blockly.MOTORDRIVERBOARD_INITNRF24L01SENDDATASS = "nRF24L01+发送数据";
197 | Blockly.MOTORDRIVERBOARD_NRFISSEND = "nRF24L01+是否发送数据成功";
198 | Blockly.MOTORDRIVERBOARD_NRFREADYDATA = "nRF24L01+是否接收到数据";
199 | Blockly.MOTORDRIVERBOARD_INITNRF24L01RECDATASSS = "nRF24L01+接收数据";
200 |
201 |
202 | Blockly.MOTORDRIVERBOARD_GPIO = "MotorDriverBoard控制IO口";
203 | Blockly.MOTORDRIVERBOARD_GPIOMODE = "设置";
204 | Blockly.MOTORDRIVERBOARD_GPIOHIGH = "高电平";
205 | Blockly.MOTORDRIVERBOARD_GPIOLOW = "低电平";
206 | Blockly.MOTORDRIVERBOARD_GPIOPWM = "输出PWM的值(0-4096)";
207 | Blockly.MOTORDRIVERBOARD_GPIOFREQ = "设置IO口输出频率(1-1600HZ)";
--------------------------------------------------------------------------------
/mixly/language/MotorDriverBoard/zh-hant.js:
--------------------------------------------------------------------------------
1 | //图形块名称翻译
2 | Blockly.MOTORDRIVERBOARD_SETUP = "MotorDriverBoard初始化";
3 | Blockly.MOTORDRIVERBOARD_DCMOTOR = "直流電機介面";
4 | Blockly.MOTORDRIVERBOARD_DCDIRECTIONS = "方向";
5 | Blockly.MOTORDRIVERBOARD_SPEED = "速度";
6 | Blockly.MOTORDRIVERBOARD_DCPORTS_FIRST = "介面1";
7 | Blockly.MOTORDRIVERBOARD_DCPORTS_SECOND = "介面2";
8 | Blockly.MOTORDRIVERBOARD_DCPORTS_THIRD = "介面3";
9 | Blockly.MOTORDRIVERBOARD_DCPORTS_FOURTH = "介面4";
10 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_FORWARD = "正轉";
11 | Blockly.MOTORDRIVERBOARD_DCDIRECTION_BACK = "反轉";
12 | Blockly.MOTORDRIVERBOARD_STOPDCMOTOR = "停止直流電機";
13 | Blockly.MOTORDRIVERBOARD_ENMOTOR = "編碼電機介面";
14 | Blockly.MOTORDRIVERBOARD_ENPORTS_FIRST = "介面1";
15 | Blockly.MOTORDRIVERBOARD_ENPORTS_SECOND = "接口2";
16 | Blockly.MOTORDRIVERBOARD_ENPORTS_THIRD = "介面3";
17 | Blockly.MOTORDRIVERBOARD_ENPORTS_FOURTH = "介面4";
18 | Blockly.MOTORDRIVERBOARD_ENDIRECTIONS = "方向";
19 | Blockly.MOTORDRIVERBOARD_ENDIRECTION_FORWARD = "正轉";
20 | Blockly.MOTORDRIVERBOARD_ENDIRECTION_BACK = "反轉";
21 | Blockly.MOTORDRIVERBOARD_STOPENMOTOR = "停止編碼電機";
22 | Blockly.MOTORDRIVERBOARD_STMOTOR = "步進電機介面";
23 | Blockly.MOTORDRIVERBOARD_STDIRECTIONS = "方向";
24 | Blockly.MOTORDRIVERBOARD_STEPS = "步數";
25 | Blockly.MOTORDRIVERBOARD_STPORTS_FIRST = "介面1";
26 | Blockly.MOTORDRIVERBOARD_STPORTS_SECOND = "介面2";
27 | Blockly.MOTORDRIVERBOARD_STDIRECTION_FORWARD = "正轉";
28 | Blockly.MOTORDRIVERBOARD_STDIRECTION_BACK = "反轉";
29 | //Blockly.MOTORDRIVERBOARD_STSTYLES = "管道";
30 | //Blockly.MOTORDRIVERBOARD_STYLE_SINGLE = "單";
31 | //Blockly.MOTORDRIVERBOARD_STYLE_DOUBLE = "雙";
32 | //Blockly.MOTORDRIVERBOARD_STYLE_INTERLEAVE = "交錯";
33 | //Blockly.MOTORDRIVERBOARD_STYLE_MICROSTEP = "微步";
34 | Blockly.MOTORDRIVERBOARD_SETRGB = "RGB燈";
35 | Blockly.MOTORDRIVERBOARD_RGBCOLOUR = "顏色";
36 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_ALL = "全部";
37 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_LEFT = "左邊";
38 | Blockly.MOTORDRIVERBOARD_RGBNUMBER_RIGHT = "右邊";
39 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_RED = "紅色";
40 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_GREEN = "綠色";
41 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_BLUE = "藍色";
42 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_YELLOW = "黃色";
43 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_PURPLE = "紫色";
44 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_WHITE = "白色";
45 | Blockly.MOTORDRIVERBOARD_RGBCOLOR_OFF = "熄滅";
46 | Blockly.MOTORDRIVERBOARD_PLAYSOUNDS = "播放聲音";
47 | Blockly.MOTORDRIVERBOARD_SOUNDS_CONNECTED = "連接";
48 | Blockly.MOTORDRIVERBOARD_SOUNDS_DISCONNECTED = "斷開連接";
49 | Blockly.MOTORDRIVERBOARD_SOUNDS_BUTTONPUSHED = "按鈕按下";
50 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE1 = "模式一";
51 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE2 = "模式二";
52 | Blockly.MOTORDRIVERBOARD_SOUNDS_MODE3 = "模式三";
53 | Blockly.MOTORDRIVERBOARD_SOUNDS_SURPRISE = "驚訝";
54 | Blockly.MOTORDRIVERBOARD_SOUNDS_OHOH = "哦";
55 | Blockly.MOTORDRIVERBOARD_SOUNDS_OHOH2 = "哦哦";
56 | Blockly.MOTORDRIVERBOARD_SOUNDS_CUDDLY = "可愛";
57 | Blockly.MOTORDRIVERBOARD_SOUNDS_SLEEPING = "困倦";
58 | Blockly.MOTORDRIVERBOARD_SOUNDS_HAPPY = "高興";
59 | Blockly.MOTORDRIVERBOARD_SOUNDS_SUPERHAPPY = "超級高興";
60 | Blockly.MOTORDRIVERBOARD_SOUNDS_SHORTHAPPY = "短暫高興";
61 | Blockly.MOTORDRIVERBOARD_SOUNDS_SAD = "悲傷";
62 | Blockly.MOTORDRIVERBOARD_SOUNDS_CONFUSED = "困惑";
63 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART1 = "討厭一";
64 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART2 = "討厭二";
65 | Blockly.MOTORDRIVERBOARD_SOUNDS_FART3 = "討厭三";
66 | Blockly.MOTORDRIVERBOARD_INITULTRASONIC = "超聲波初始化";
67 | Blockly.MOTORDRIVERBOARD_READULTRASONICDISTANCE = "讀取超聲波距離";
68 | Blockly.MOTORDRIVERBOARD_INITIRREMOTE = "紅外接收初始化";
69 | Blockly.MOTORDRIVERBOARD_IFIRREMOTEPRESSED = "红外遥控器按键被按下";
70 | Blockly.MOTORDRIVERBOARD_IRKEYPRESS = "emakefun紅外遙控器按鍵按下";
71 | Blockly.MOTORDRIVERBOARD_IRKEYPRESS2 = "普通紅外遙控器按鍵按下";
72 | Blockly.MOTORDRIVERBOARD_IRKEY_UP = "上";
73 | Blockly.MOTORDRIVERBOARD_IRKEY_DOWN = "下";
74 | Blockly.MOTORDRIVERBOARD_IRKEY_LEFT = "左";
75 | Blockly.MOTORDRIVERBOARD_IRKEY_RIGHT = "右";
76 | Blockly.MOTORDRIVERBOARD_INITNRF24L01 = "NRF24L01初始化";
77 | Blockly.MOTORDRIVERBOARD_INITNRF24L01SENDDATA = "NRF24L01發送數據";
78 | Blockly.MOTORDRIVERBOARD_INITNRF24L01ADDRESS = "地址";
79 | Blockly.MOTORDRIVERBOARD_INITNRF24L01DATA = "數據";
80 | Blockly.MOTORDRIVERBOARD_INITNRF24L01RECEIVEDATA = "NRF24L01接收數據";
81 | Blockly.MOTORDRIVERBOARD_INITNRF24L01ISNOTNULL = "NRF24L01數據不為空";
82 | Blockly.MOTORDRIVERBOARD_GETINITNRF24L01 = "獲取NRF24L01數據";
83 | Blockly.MOTORDRIVERBOARD_PS2INIT = "PS2手柄初始化";
84 | Blockly.MOTORDRIVERBOARD_WHICHPS2KEYPRESSED = "PS2鍵被按下";
85 | Blockly.MOTORDRIVERBOARD_SETPS2VIBRATE = "設定ps2搖杆震動值";
86 | Blockly.MOTORDRIVERBOARD_PS2KEYPRESS = "ps2手柄按下";
87 | Blockly.MOTORDRIVERBOARD_PS2KEYS_UP = "上";
88 | Blockly.MOTORDRIVERBOARD_PS2KEYS_DOWN = "下";
89 | Blockly.MOTORDRIVERBOARD_PS2KEYS_LEFT = "左";
90 | Blockly.MOTORDRIVERBOARD_PS2KEYS_RIGHT = "右";
91 | Blockly.MOTORDRIVERBOARD_PS2KEYS_TRIANGLE = "△";
92 | Blockly.MOTORDRIVERBOARD_PS2KEYS_CIRCLE = "○";
93 | Blockly.MOTORDRIVERBOARD_PS2KEYS_CROSS = "×";
94 | Blockly.MOTORDRIVERBOARD_PS2KEYS_SQUARE = "囗";
95 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L1 = "左1";
96 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L2 = "左2";
97 | Blockly.MOTORDRIVERBOARD_PS2KEYS_L3 = "左3";
98 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R1 = "右1";
99 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R2 = "右2";
100 | Blockly.MOTORDRIVERBOARD_PS2KEYS_R3 = "右3";
101 | Blockly.MOTORDRIVERBOARD_PS2KEYS_SELECT = "選擇";
102 | Blockly.MOTORDRIVERBOARD_PS2KEYS_START = "開始";
103 | Blockly.MOTORDRIVERBOARD_PS2KEYUNPRESS = "ps2手柄鬆開";
104 | Blockly.MOTORDRIVERBOARD_PS2GETVIBRATE = "獲取搖杆值";
105 | Blockly.MOTORDRIVERBOARD_VIBRATE_LX = "左橫軸";
106 | Blockly.MOTORDRIVERBOARD_VIBRATE_LY = "左縱軸";
107 | Blockly.MOTORDRIVERBOARD_VIBRATE_RX = "右橫軸";
108 | Blockly.MOTORDRIVERBOARD_VIBRATE_RY = "右縱軸";
109 | Blockly.MOTORDRIVERBOARD_PS2STATUS = "讀取ps2狀態";
110 | Blockly.MOTORDRIVERBOARD_PS2GETVIBRATE2 = "獲取搖杆角度";
111 | Blockly.MOTORDRIVERBOARD_VIBRATE2_L = "左搖杆";
112 | Blockly.MOTORDRIVERBOARD_VIBRATE2_R = "右搖杆";
113 | Blockly.MOTORDRIVERBOARD_SERVOPORT = "舵機介面";
114 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FIRST = "介面1";
115 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SECOND = "介面2";
116 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_THIRD = "介面3";
117 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FOURTH = "介面4";
118 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_FIVETH = "介面5";
119 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SIXTH = "介面6";
120 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_SEVENTH = "介面7";
121 | Blockly.MOTORDRIVERBOARD_SERVOPORTS_EIGHTH = "介面8";
122 | Blockly.MOTORDRIVERBOARD_ANGLE = "角度";
123 | Blockly.MOTORDRIVERBOARD_RED = "紅";
124 | Blockly.MOTORDRIVERBOARD_GREEN = "綠";
125 | Blockly.MOTORDRIVERBOARD_BLUE = "藍";
126 | Blockly.MOTORDRIVERBOARD_READDEGEREES = "讀取當前舵機角度";
127 |
128 | Blockly.MOTORDRIVERBOARD_INITDCMOTOR = "直流電機初始化";
129 | Blockly.MOTORDRIVERBOARD_INITENMOTOR = "編碼電機初始化";
130 | Blockly.MOTORDRIVERBOARD_INITSTMOTOR = "步進電機初始化";
131 | Blockly.MOTORDRIVERBOARD_INITRGB = "RGB燈初始化";
132 | Blockly.MOTORDRIVERBOARD_INITSOUNDS = "蜂鳴器初始化";
133 | Blockly.MOTORDRIVERBOARD_INITSERVO = "舵機初始化 介面";
134 |
135 | Blockly.MOTORDRIVERBOARD_M4INIT = "四驅車初始化電機介面";
136 | Blockly.MOTORDRIVERBOARD_LEFTFORWARD = "左前";
137 | Blockly.MOTORDRIVERBOARD_RIGHTFORWARD = "右前";
138 | Blockly.MOTORDRIVERBOARD_LEFTBACKWARD = "左後";
139 | Blockly.MOTORDRIVERBOARD_RIGHTBACKWARD = "右後";
140 | Blockly.MOTORDRIVERBOARD_M4GOFORWARD = "四驅車前進 速度";
141 | Blockly.MOTORDRIVERBOARD_M4BACKFORWARD = "四驅車後退 速度";
142 | Blockly.MOTORDRIVERBOARD_M4TURNLEFT = "四驅車左轉 速度";
143 | Blockly.MOTORDRIVERBOARD_M4TURNRIGHT = "四驅車右轉 速度";
144 | Blockly.MOTORDRIVERBOARD_M4TURNLEFTS = "四驅車左自旋 速度";
145 | Blockly.MOTORDRIVERBOARD_M4TURNRIGHTS = "四驅車右自旋 速度";
146 | Blockly.MOTORDRIVERBOARD_M4GODEGREE = "四驅車行駛角度";
147 | Blockly.MOTORDRIVERBOARD_M4GOSPEED = "速度";
148 | Blockly.MOTORDRIVERBOARD_M4STOP = "四驅車停止";
149 | Blockly.MOTORDRIVERBOARD_BLUETOOTHINIT = "藍牙初始化";
150 | Blockly.MOTORDRIVERBOARD_RECEIVEDATA = "接收藍牙數據";
151 | Blockly.MOTORDRIVERBOARD_RECEIVEDDDATA = "接收到了藍牙數據";
152 | Blockly.MOTORDRIVERBOARD_BLUETOOTHPRESS = "藍牙操作鍵按下";
153 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE = "藍牙資料類型";
154 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_BUTTONS = "按鍵";
155 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_DIRECTIONS = "角度";
156 | Blockly.MOTORDRIVERBOARD_BLUETOOTHSTYLE_SPEEDS = "速度";
157 | Blockly.MOTORDRIVERBOARD_BLUETOOTHGETDEGREE = "藍牙獲取的角度";
158 |
159 | Blockly.MOTORDRIVERBOARD_BLUETOOTHGETSPEED = "藍牙獲取的速度";
160 | Blockly.MOTORDRIVERBOARD_NRFINIT = "nRF24L01+初始化 地址";
161 | Blockly.MOTORDRIVERBOARD_NRFDATAREADY = "nRF24L01+接收到數據";
162 | Blockly.MOTORDRIVERBOARD_NRFVALUE = "定義接收nrf數據的數組";
163 | Blockly.MOTORDRIVERBOARD_NRFGETDATA = "取nRF24L01+數據";
164 | Blockly.MOTORDRIVERBOARD_NRFGETPACKAGE = "收到讀取nRF24L01+無線手柄數據";
165 | Blockly.MOTORDRIVERBOARD_NRFNEWOB = "創建nrf資料類型對象";
166 | Blockly.MOTORDRIVERBOARD_NRFDATAFUN = "獲取收到讀取nRF24L01+無線手柄資料類型";
167 | Blockly.MOTORDRIVERBOARD_NRFDIRECTION = "方向";
168 | Blockly.MOTORDRIVERBOARD_NRFSPEED = "速度";
169 | Blockly.MOTORDRIVERBOARD_NRFBUTTON = "按键";
170 | Blockly.MOTORDRIVERBOARD_NRFBUTTONS = "無線手柄按鍵按下";
171 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSL1 = "左1";
172 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSR1 = "右1";
173 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSUP = "上";
174 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSDOWN = "下";
175 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSLEFT = "左";
176 | Blockly.MOTORDRIVERBOARD_NRFBUTTONSRIGHT = "右";
177 | Blockly.MOTORDRIVERBOARD_NRFGETDEGREE = "nRF24L01+獲取角度";
178 | Blockly.MOTORDRIVERBOARD_NRFGETSPEED = "nRF24L01+獲取速度";
179 | Blockly.MOTORDRIVERBOARD_SETRGBBRIGHTNESS = "設定RGB燈亮度(0~255)";
180 |
181 |
182 |
--------------------------------------------------------------------------------
/mixly/media/Motordriverboard/em_md_qr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emakefun/MotorDriverBoard/4051027d1ec5340fda865871b807f75f68d594fc/mixly/media/Motordriverboard/em_md_qr.png
--------------------------------------------------------------------------------