【Mind+掌控宝】
在Mind+使用掌控宝M1,M2电机。
使用方法如下:
1、打开mPython,千里马。
![【智控万物】Mind+驱动掌控宝电机图1](https://mc.dfrobot.com.cn/data/attachment/forum/202102/04/181629b7ni78n1coa1an7g.png)
2、代码模式
![【智控万物】Mind+驱动掌控宝电机图2](https://mc.dfrobot.com.cn/data/attachment/forum/202102/04/182034s4o740s6ohgrrr8g.png)
- from mpython import *
-
- from nplus import *
-
- car=Car()
- car.set_motor_speed(100, 100)
复制代码
3、找到nplus.py
![【智控万物】Mind+驱动掌控宝电机图3](https://mc.dfrobot.com.cn/data/attachment/forum/202102/04/182357fu4q7b4y77xbbjum.png)
4、将nplus.py加载到掌控宝文件中
![【智控万物】Mind+驱动掌控宝电机图4](https://mc.dfrobot.com.cn/data/attachment/forum/202102/04/182619o2lv3md55534jb9b.png)
5、编写程序
![【智控万物】Mind+驱动掌控宝电机图5](https://mc.dfrobot.com.cn/data/attachment/forum/202102/04/230700j5b8xvzgrxrxt74g.png)
- # MindPlus
- # mpython
- from mpython import *
- import time
- from nplus import *
- car=Car()
- while True:
- car.set_motor_speed(60, -60)
- time.sleep(2)
- car.set_motor_speed(0, 0)
- time.sleep(2)
- car.set_motor_speed(-60, 60)
- time.sleep(2)
- car.set_motor_speed(0, 0)
- time.sleep(2)
复制代码
6、掌控宝小车
![【智控万物】Mind+驱动掌控宝电机图6](https://mc.dfrobot.com.cn/data/attachment/forum/202102/04/231022bo22o22svxgmkgx0.jpg)
7、演示视频
|