回到首页 返回首页
回到顶部 回到顶部
返回上一页 返回上一页

一个破烂的洗手机 简单

头像 二哈666 2020.10.08 503 1

在论坛上我看见有很多大神制作自动洗手机,我也想做一个。材料如下。

材料清单

  • 掌控板 IO扩展板 IO电机驱动扩展板套餐 X1 链接
  • 巡线传感器 X1 链接
  • TT马达【没有编码器也行】 X1 链接
  • 诚心【手动滑稽】(*^▽^*)(*^▽^*) X1 链接

步骤1 组装结构硬件

我们要先接好线。【马达接M1,巡线传感器接P0】接线不需要说了吧,不需要再让我画接线图了吧。

【其实是我不会画接线图】,然后该用到诚心了,准备一个黑纸盒子,把TT马达固定在里面,然后放一个轴,放一点绳子就OK了。图在下面,爱看不看。

ヽ(ー_ー)ノ



project-image
project-image

然后往掌控板里上传程序。我先把代码放在这里,图形化程序在后面的附件里。【代码用Mind+上传】


代码
/*!
 * MindPlus
 * mpython
 *
 */
#include <MPython.h>
#include <IOBOX_Motor.h>
#include <DFRobot_Task.h>
newTask(loop1)
// 静态常量
const uint8_t imageMatrix[][350] = {
	{0x0,0x0,0x0,0x1f,0x80,0x0,0x0,0x0,0x0,0x0,0x30,0xc0,0x0,0x0,0x0,0x0,0x0,0x60,0x60,0x0,0x0,0x0,0x0,0x0,0x40,0x20,0x0,0x0,0x0,0x0,0x0,0x40,0x20,0x0,0x0,0x0,0x0,0x0,0x40,0x20,0x0,0x0,0x0,0x0,0x0,0x60,0x60,0x0,0x0,0x0,0x0,0x0,0x30,0xc0,0x0,0x0,0x0,0x0,0x0,0x33,0x80,0x0,0x0,0x0,0x1e,0x0,0x22,0x0,0x0,0x0,0x0,0x33,0x80,0x62,0x0,0x3c,0x0,0x0,0x60,0xc0,0x46,0x0,0xee,0x0,0x0,0x40,0xc0,0xc6,0x1,0x83,0x0,0x0,0xc0,0x40,0x86,0x1,0x1,0x80,0x0,0x40,0xc1,0x8c,0x1,0x1,0x80,0x0,0x7c,0x9f,0xff,0x1,0x1,0x80,0x0,0x37,0x98,0x3,0x81,0xa3,0x0,0x0,0x24,0x30,0x0,0x83,0x26,0x0,0x0,0x64,0x30,0x0,0xc6,0x7c,0x0,0x0,0xc7,0xff,0xff,0xf8,0x40,0x0,0x7f,0xff,0xff,0xff,0xff,0xfc,0x0,0xfe,0x0,0x0,0x0,0x1,0xff,0xc0,0xc0,0x0,0x0,0x0,0x0,0x1,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0,0x3f,0xff,0xff,0xe0,0x1,0x80,0xdc,0x0,0x0,0x0,0x3,0xf9,0x80,0xcf,0xff,0xff,0xff,0xfc,0x5,0x80,0xcb,0xff,0xff,0xff,0xff,0xf5,0x80,0xcb,0xf8,0xff,0xff,0x9f,0xf9,0x80,0xcb,0xf8,0x7f,0xff,0xf,0xf9,0x80,0xcb,0xf8,0x7f,0xff,0xf,0xe9,0x80,0xcb,0xf8,0x7f,0xff,0xf,0xe9,0x80,0x4b,0xf8,0x7f,0xff,0xf,0xe9,0x80,0x68,0x7c,0xff,0xff,0x1f,0xf1,0x80,0x63,0x87,0xff,0xff,0xff,0x93,0x0,0x60,0x38,0x7f,0xff,0xf0,0x33,0x0,0x60,0x3,0x8f,0xfe,0xf,0x83,0x0,0x60,0x0,0x38,0x3,0xe0,0x3,0x0,0x60,0x0,0x7,0xf8,0x0,0x3,0x0,0x60,0x0,0x0,0x0,0x0,0x3,0x0,0x60,0x0,0x0,0x0,0x0,0x3,0x0,0x60,0x0,0x0,0x0,0x0,0x3,0x0,0x60,0x0,0x0,0x0,0x0,0x6,0x0,0x60,0x0,0x0,0x0,0x0,0x6,0x0,0x60,0x0,0x0,0x0,0x0,0x6,0x0,0x7f,0xff,0xff,0xff,0xff,0xfe,0x0,0x7f,0xff,0xff,0xff,0xff,0xfe,0x0}
};
// 创建对象
IOBOX_Motor motor_ib;


// 主程序开始
void setup() {
	mPython.begin();
	motor_ib.motorStop(motor_ib.ALL);
	display.setCursorLine(1);
	display.printLine("洗手机器,作者还是x");
	display.setCursorLine(2);
	display.printLine("xx");
	display.setCursor(42, 22);
	display.print("Mind+666");
	delay(2000);
	display.drawImage(39, 7, 50, 50, imageMatrix[0]);
	taskStart(loop1);
	buzz.play(ODE, Forever);
	buzz.play(BLUES, ForeverInBackground);
}
void loop() {

}

// 子线程1程序开始
void loop1::setup() {

}
void loop1::loop() {
	if ((digitalRead(P0))) {
		for (int index = 0; index < 10; index++) {
			motor_ib.motorRun(motor_ib.M1, motor_ib.CW, 255);
			yield();
		}
		delay(3000);
		motor_ib.motorRun(motor_ib.M1, motor_ib.CCW, 255);
		delay(1000);
		motor_ib.motorStop(motor_ib.M1);
		for (int index = 0; index < 10; index++) {
			motor_ib.motorRun(motor_ib.M2, motor_ib.CW, 255);
			yield();
		}
		motor_ib.motorStop(motor_ib.M2);
		rgb.write(-1, 0x0000FF);
		display.setCursor(42, 22);
		display.print("Mind+");
		delay(1000);
		display.drawImage(39, 7, 50, 50, imageMatrix[0]);
	}
}

后边是图形化的附件。我可不是那么喜欢传视频的人,所以我没有传视频。【其实是我不喜欢录视频,觉得麻烦】


评论

user-avatar
  • 二哈666

    二哈6662020.10.08

    厉害

    0