⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 turn.c

📁 一个机器人提足球的代码!基于神经网络! 一个机器人提足球的代码!基于神经网络!
💻 C
字号:
#ifndef _TURN_
#define _TURN_
#include "HardwareInfo.c"
#include <SetSysTime.h>
#include <GetCompassB.h>
#include <GetSysTime.h>
#include <SetMotor.h>
#include <GetCompoI.h>

void turn(unsigned char jGuan)
{
    unsigned int degree = 0;   //指南针返回值
    unsigned long t = 0;   //系统时间
    unsigned char fy3 = 0;   //当前3号复眼通道
    unsigned char fy4 = 0;   //当前4号复眼通道
    unsigned char fy5 = 0;   //当前5号复眼通道
    unsigned int p1 = 45;   //场定义角
    unsigned int p2 = 315;   //场定义角
    t=0;
    SetSysTime(0);
    while ( ((degree>5)&&(degree<355))  )
    {
        degree = GetCompassB(_COMPASS_jd_);
        t = GetSysTime();
        if ( t>100 )
        {
            break;
        }
    }
    SetMotor(_MOTOR_left_, 2, 100);
    SetMotor(_MOTOR_right_, 2, 80);
    degree = GetCompassB(_COMPASS_jd_);
    t=0;
    SetSysTime(0);
    fy3 = GetCompoI(_COMPOUNDEYE_fy_, 3);
    fy4 = GetCompoI(_COMPOUNDEYE_fy_, 4);
    fy5 = GetCompoI(_COMPOUNDEYE_fy_, 5);
    while ( ((fy3<jGuan||fy4<jGuan || fy5 <jGuan) && ((degree<p1) ||(degree>p2))) && (t<60) )
    {
        degree = GetCompassB(_COMPASS_jd_);
        fy3 = GetCompoI(_COMPOUNDEYE_fy_, 3);
        fy4 = GetCompoI(_COMPOUNDEYE_fy_, 4);
        fy5 = GetCompoI(_COMPOUNDEYE_fy_, 5);
        t = GetSysTime();
    }
    t=0;
    SetSysTime(0);
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -