1

MQTT

主题:

小程序——-硬件:jm_y2m

硬件——-小程序:jm_m2y

引脚

uno r3 引脚定义

直流电机驱动板:5 6 10 11
蜂鸣器 5v:8
超声波传感器 5v:A0 A1
LED 5v:7
光线传感器 5v:A3
人体红外传感器 3.3v:A2
软串口:3, 4

wifi d1 引脚定义

DHT11 5v :D7
触摸按键 3.3v :D8
OLED 5v :D15—SCL D14—SDA
软串口:RX=D8,TX=D9

指令

esp8266——->uno r3

串口

方向:

前:w

后:s

左:a

右:d

刹车: q

蜂鸣器:

设置(1声):1

消息(3声):3

设置小夜灯模型:

小夜灯开:n

小夜灯关:l

设置避障模式:

开启避障:o

关闭避障:p

初始化完成提示:

消息(3声):3

车速设置:

1 2 3档

z x c

小程序———->esp8266

消息

  • 小程序发送
1
2
3
4
5
6
7
{
"source": "app",
"type": "msg",
"msg1": "微信查找公众号",
"msg2": "1234567",
"msg3": "qwertydf"
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"success\"}

设置

消息提醒次数

  • 小程序发送
1
2
3
4
5
6
{
"source": "app",
"type": "set",
"device":"MSG_BEEP_TIMES",
"payload":3
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

备忘录模式

  • 小程序发送

    1开 0关

1
2
3
4
5
6
{
"source": "app",
"type": "set",
"device":"KEEP_MSG",
"payload":1
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

小夜灯开关

  • 小程序发送

    //n 开 l 关

1
2
3
4
5
6
{
"source": "app",
"type": "set",
"device":"night_light",
"payload":"n"
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

避障模式开关

  • 小程序发送

    //o 开 p 关

1
2
3
4
5
6
{
"source": "app",
"type": "set",
"device":"barrier_status",
"payload":"o"
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

静音模式

  • 小程序发送
1
2
3
4
5
6
7
 //1 普通 2 静音
{
"source": "app",
"type": "set",
"device":"MODE",
"payload":1
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

重新配网

  • 小程序发送
1
2
3
4
5
{
"source": "app",
"type": "set",
"device":"changewifi"
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

修改城市

  • 小程序发送
1
2
3
4
5
6
{
"source": "app",
"type": "set",
"device":"CITY",
"payload":"lanzhou"
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

更换APIKEY

  • 小程序发送
1
2
3
4
5
6
{
"source": "app",
"type": "set",
"device":"APIKEY",
"payload":"123dasdasd"
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"setted\"}

判断8266是否在线

  • 小程序发送
1
2
3
4
5
{
"source": "app",
"type": "set",
"device":"is_connected"
}
  • 8266反馈
1
{\"source\":\"device\",\"status\":\"is_connected\"}

上传数据

获取环境温湿度 获取小夜灯状态

  • 小程序发送
1
2
3
4
{
"source": "app",
"type": "update"
}
  • 8266反馈
1
{"temp":20,"humi":30,"barrier_status","o",night_light_status":"n","MODE":1,"KEEP_MSG":0,"car_speed":""}

小车控制

前后左右

  • 小程序发送

前:

1
2
3
4
5
{
"source": "app",
"type": "car",
"directions":"front"
}

后:

1
2
3
4
5
{
"source": "app",
"type": "car",
"directions":"back"
}

左:

1
2
3
4
5
{
"source": "app",
"type": "car",
"directions":"left"
}

右:

1
2
3
4
5
{
"source": "app",
"type": "car",
"directions":"right"
}

停:

1
2
3
4
5
{
"source": "app",
"type": "car",
"directions":"stop"
}
  • 8266反馈
1
"{\"source\":\"device\",\"status\":\"received\"}"

车速

  • 小程序发送

    一档z :speed1

    二档x :speed2

    三档c:speed3

1
2
3
4
5
{
"source": "app",
"type": "car",
"directions":"speed1"
}
  • 8266反馈
1
"{\"source\":\"device\",\"status\":\"received\"}"