主控板 |
Basra主控板(兼容Arduino Uno)
|
扩展板 |
Bigfish2.1扩展板
|
通信 | WiFi无线路由器 |
2510通信转接板 | |
电池 | 7.4V锂电池 |
其它 |
摄像头、安卓手机 |
下面提供一个实现WiFi视频遥控行星探测车移动以及打开、关闭行星探测车太阳翼功能的参考程序(Wifi_Control.ino):
/*------------------------------------------------------------------------------------ 版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved. Distributed under MIT license.See file LICENSE for detail or copy at https://opensource.org/licenses/MIT by 机器谱 2023-09-22 https://www.robotway.com/ ------------------------------*/ void serialEvent() { static int i; static boolean revStart; while (Serial.available()) { //get data from wifi int inData = Serial.read(); if (inData == 0xff && !revStart) { revStart = true; } else if(revStart) { inputData[i] = inData; i++; if(i > 3) { if(inputData[3] == 0xff) { dataComplete = true; i = 0; revStart = false; } else { i = 0; revStart = false; } } } } } //小车主程序 void car_control(){ if(dataComplete){ dataComplete = false; //控制小车前,后,左,右 if(inputData[0] == 0x00) { if(inputData[1] != moveDirection){ moveDirection = inputData[1]; } } else if(inputData[0] == 0x02){ if(inputData[1] == 0x01){ if(inputData[2] != DownDireciton){ DownDireciton = inputData[2]; if(DownDireciton == 0 && !isPanelDown){ expandSolarPanelsAndMast(); isPanelDown = true; } else if(DownDireciton == 10 && isPanelDown){ stopSolarPanelsAndMast(); isPanelDown = false; } } } } Move(moveDirection); } else{ //小车自主控制部分 automatic_control(); } }