在 CODE COMPOSER 的 MSP432 c 程序中执行 Simon Says随机 LED

问题描述

我想编辑这个代码,它是一个使用 Leds 的随机生成器,但想在用户输入模式时增加随机长度,这是我到目前为止所得到的,使用 MSP432 启动板在代码编写器 c 中进行编程,是一个简单的西蒙说游戏这只是随机生成器,无法上传完整代码请给我留言以获取更多代码

enter code here




unsigned int leds;

srand(time(NULL));

for (leds = 0; leds < 3; ++leds)
{
    patron[leds] = (rand()%10);


    if(patron[leds] == 1)
    {
        // turn on the segment
        P2OUT |= bits[leds];
    }
    else
    {
        // turn off the segment
        P2OUT &= ~bits[leds];
    }
}

unsigned int leds;

WDTCTL = WDTPW | WDTHOLD;               // Stop WDT
P2DIR |=BIT3|BIT4|BIT5;                          // set pins as outputs

while (1)                               // continuous loop
{
    randomgenerator(leds);
    leds++;
    if(leds == 10)
    {
        leds = 0;
    }
    for (i = 200000; i > 0; i--); // Delay
}

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...