找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3650|回复: 0
收起左侧

避障程序纠错

[复制链接]
ID:40285 发表于 2012-5-15 16:59 | 显示全部楼层 |阅读模式
#include #define FLeftMotor {P0^2=1; P0^3=0;} #define BLeftMotor {P0^2=0; P0^3=1;} #define FRightMotor {P0^5=1; P0^4=0;} #define BRightMotor {P0^5=0; P0^4=1;} #define LeftStop {P0^2=0; P0^3=0;} #define RightStop {P0^4=0; P0^5=0;} #define CarStop {P0^2=0; P0^3=0; P0^4=0; P0^5=0;} sbit RightSenser=P0^0; sbit LeftSenser=P0^1; //******************************************************** // 左转 //******************************************************** void TurnLeft_1() { LeftStop ; FRightMotor ; } //******************************************************** // 快速左转 //******************************************************** void TurnLeft_Fast() { BLeftMotor ; FRightMotor ; } //******************************************************** // 右转 //******************************************************** void TurnRight_1() { RightStop ; FLeftMotor ; } //******************************************************** // 快速右转 //******************************************************** void TurnRight_Fast() { BRightMotor ; FLeftMotor ; } //******************************************************** // 用倒退的方式进行车头右转 //******************************************************** void BTurnRight_1() { LeftStop ; BRightMotor ; } //******************************************************** // 用倒退的方式进行车头左转 //******************************************************** void BTurnLeft_1() { RightStop ; BLeftMotor ; } //******************************************************** // 前进 //******************************************************** void FCar() { FLeftMotor ; FRightMotor ; } //******************************************************** // 后退 //******************************************************** void BCar() { BLeftMotor ; BRightMotor ; } //******************************************************** // 壁障程序 //******************************************************** void Obstacle_Avoid(void) { if(RightSenser && LeftSenser) { FCar() ; } if((!RightSenser) && LeftSenser) { BTurnLeft_1() ; } if(RightSenser && (!LeftSenser)) { BTurnRight_1() ; } 这个程序的编译结果总是显示 Build target 'Target 1' assembling STARTUP.A51... compiling bizhang.c... BIZHANG.C(25): error C141: syntax error near '=' BIZHANG.C(25): error C141: syntax error near '=' BIZHANG.C(26): error C141: syntax error near '=' BIZHANG.C(26): error C141: syntax error near '=' BIZHANG.C(37): error C141: syntax error near '=' BIZHANG.C(37): error C141: syntax error near '=' BIZHANG.C(38): error C141: syntax error near '=' BIZHANG.C(38): error C141: syntax error near '=' BIZHANG.C(48): error C141: syntax error near '=' BIZHANG.C(48): error C141: syntax error near '=' BIZHANG.C(49): error C141: syntax error near '=' BIZHANG.C(49): error C141: syntax error near '=' BIZHANG.C(59): error C141: syntax error near '=' BIZHANG.C(59): error C141: syntax error near '=' BIZHANG.C(60): error C141: syntax error near '=' BIZHANG.C(60): error C141: syntax error near '=' BIZHANG.C(70): error C141: syntax error near '=' BIZHANG.C(70): error C141: syntax error near '=' BIZHANG.C(71): error C141: syntax error near '=' BIZHANG.C(71): error C141: syntax error near '=' BIZHANG.C(80): error C141: syntax error near '=' BIZHANG.C(80): error C141: syntax error near '=' BIZHANG.C(81): error C141: syntax error near '=' BIZHANG.C(81): error C141: syntax error near '=' BIZHANG.C(92): error C141: syntax error near '=' BIZHANG.C(92): error C141: syntax error near '=' BIZHANG.C(93): error C141: syntax error near '=' BIZHANG.C(93): error C141: syntax error near '=' BIZHANG.C(103): error C141: syntax error near '=' BIZHANG.C(103): error C141: syntax error near '=' BIZHANG.C(104): error C141: syntax error near '=' BIZHANG.C(104): error C141: syntax error near '=' Target not created 请各位帮忙修改一下……
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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