找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2999|回复: 0
打印 上一主题 下一主题
收起左侧

基于stc15单片机的遥控火星车

[复制链接]
跳转到指定楼层
楼主
ID:596325 发表于 2019-8-10 14:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 venom6 于 2019-8-10 14:25 编辑

车是一款独创的基于STC15W4K61S4单片机的全地形物联网运输车。它的机械结构部分参照了2011年的好奇号火星探测器,为了适应城市中的楼梯、台阶等地形又将它的机械结构做了调整。作品电路包括蓝牙模块、远程图传模块、MP3模块、矩阵按键密码箱、GPS模块以及基本的供电、运动模块,所有功能均可用单个上位机远程操控。其主要功能是实现快递、外卖的短途运输,且该过程均可由操作者远程实现,此外作品还可以应用于复杂地形的探险、救援、物资运输等领域。如有朋友想详细了解车的结构和单片机程序,可以评论下。本人很菜,希望与大家交流。
******************************************************************************/
#include "main.h"
#include "delay.h"
#include "uart.h"
#define uchar unsigned char
#define uint unsigned int
#define KEY P1
uchar k;
uint a=0;
uchar code table[]={0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00};
uchar code key_code[]={0x77, 0xb7, 0xd7, 0x7b, 0xbb, 0xdb, 0x7d, 0xbd, 0xdd, 0xbe};
uchar code pass_word[3]={1,2,3};
uint mima[3]={0,0,0};

******************************************/
/
void GPIO_config(void)
{
P0M1 = 0; P0M0 = 0;
P1M1 = 0; P1M0 = 0;
P2M0 = 0; P2M1 = 0;
P3M1 = 0; P3M0 = 0;
P4M1 = 0; P4M0 = 0;
P5M0 = 0;
P5M1 = 0;
}
/*****************************************/
void main(void)
{
KEY=0xff;
GPIO_config();
UartInit();
Uart2SendString("Please enter your command:\r\n");
delay_ms(200);

while(1)
{
  if(Hand("MP3"))
  {  
   LED = LED_ON;
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#001P1501T0000!");
   Uart2SendString("#001P1501T0000!");         
  }
  if(Hand("Z"))
  {  
   LED = LED_ON;
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#001P1511T0000!");
   Uart2SendString("#001P1511T0000!");         
  }
  
  if(Hand("S"))
  {  
   LED = LED_OFF;
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#001P1499T0000!");
   Uart2SendString("#001P1499T0000!");         
  }
  if(Hand("NEXT"))
  {  
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#001P1496T0000!");
   Uart2SendString("#001P1496T0000!");         
  }
  if(Hand("#001P1495T0000!"))
  {  
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#001P1495T0000!");
   Uart2SendString("#001P1495T0000!");         
  }
  if(Hand("UP"))
  {  
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#001P1494T0000!");
   Uart2SendString("#001P1494T0000!");         
  }
  if(Hand("#001P1493T0000!"))
  {  
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#001P1493T0000!");
   Uart2SendString("#001P1493T0000!");         
  }
  else if(Hand("GO"))
  {  
       IN1 =1;
          IN2 =0;
          IN3 =0;
          IN4 =1;
   CLR_Buf();
   SendString("#Command: GO, Executed!\r\n");         
  }
  else if(Hand("BAC"))
  {  
       IN1 =0;
          IN2 =1;
          IN3 =1;
          IN4 =0;
   CLR_Buf();
   SendString("#Command: BACK, Executed!\r\n");         
  }
  else if(Hand("LEFT"))
  {      
     IN1 =1;
      IN2 =0;
          IN3 =1;
          IN4 =0;  
   CLR_Buf();
   SendString("#Command: LEFT, Executed!\r\n");         
  }
  else if(Hand("RIGHT"))
  {      
     IN1 =0;
     IN2 =1;
     IN3 =0;
     IN4 =1;
   CLR_Buf();
   SendString("#Command: RIGHT, Executed!\r\n");         
  }
  else if(Hand("TING"))
  {      
     IN1 =0;
     IN2 =0;
     IN3 =0;
     IN4 =0;
     MIMASUO =1;
       BEEP=1;
   CLR_Buf();
   SendString("#Command: TING, Executed!\r\n");         
  }
  else if(Hand("K"))
  {      
     MIMASUO =0;
      BEEP=0;
   CLR_Buf();
   Uart2CLR_Buf();
   SendString("#Command: KAISUO, Executed!\r\n");
   Uart2SendString("#001P1513T0000!");         
  }
  else if(Uart2Hand("ledoff"))
  {
   LED = LED_OFF;   
   Uart2CLR_Buf();
   Uart2SendString("LED Off!\r\n");         
  }
}
}



评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表