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

📄 processselector.c

📁 一个机器人提足球的代码!基于神经网络! 一个机器人提足球的代码!基于神经网络!
💻 C
字号:
#include "HardwareInfo.c"
#include <GetSelector.h>
#include "kickAndDefengsiveFootball.c"
#include "defengsiveFootball.c"
#include "kickFootball.c"
#include <GetCompoI.h>
#include <SetLCD3Char.h>
#include <GetCompassB.h>
#include <GetUltrasound.h>

// define global var
unsigned int beginDeathHeading = 0;   //存储上一循环时的角度,也就是刚卡死时的角度
unsigned long beginDeathTime = 0;   //存储上一循环时的时间,也就是刚卡死时的时间
unsigned int g_distanceLeft = 0;   //存储左超声测距模块的返回值

int main(void)
{
    unsigned char value = 0;   //程序选择器的返回值。
    unsigned char yfy = 140;
    unsigned char var0 = 110;
    unsigned char fyMax = 0;
    unsigned char fyMin = 0;
    unsigned int b = 0;
    unsigned int distance_left = 0;
    unsigned int distance_middle = 0;
    while (1)
    {
        value = GetSelector(_SELECTOR_1_);
        if ( value==1 )
        {
            break;
        }
        else
        {
            if ( value==2 )
            {
                break;
            }
            else
            {
                if ( value==3 )
                {
                    break;
                }
                else
                {
                    if ( value==4 )
                    {
                        break;
                    }
                    else
                    {
                        if ( value==5 )
                        {
                            break;
                        }
                    }
                }
            }
        }
    }
    while ( value==1 )
    {
        kickAndDefengsiveFootball(15, yfy, var0, 30, 120, 60, 17, 7, 30, 190, 45, 31);
    }
    while ( value==2 )
    {
        defengsiveFootball(yfy, var0, 140, 29, 60, 7, 31, 7, 17, 30);
    }
    while ( value==3 )
    {
        kickFootball(yfy, var0, 120, 190, 29, 60, 45);
    }
    while ( value==4 )
    {
        fyMax = GetCompoI(_COMPOUNDEYE_fy_, 9);
        fyMin = GetCompoI(_COMPOUNDEYE_fy_, 11);
        SetLCD3Char(1, fyMax);
        SetLCD3Char(9, fyMin);
    }
    while ( value==5 )
    {
        b = GetCompassB(_COMPASS_jd_);
        distance_left = GetUltrasound(_ULTRASOUND_left_);
        distance_middle = GetUltrasound(_ULTRASOUND_middle_);
        SetLCD3Char(1, b);
        SetLCD3Char(6, distance_left);
        SetLCD3Char(11, distance_middle);
    }
    return 1;
}

⌨️ 快捷键说明

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