当前位置:网站首页>【蓝桥杯单片机 国赛 第十一届】
【蓝桥杯单片机 国赛 第十一届】
2022-06-12 11:23:00 【Tjyuking】
惯例思路

好久没碰蓝桥杯了,终于开始准备国赛了…,之后每刷一套题都来写一篇经验博客,感觉只要模块是对的,就能写出来,大家加油
写题过程
还是首先花大概10多分钟看一下题目,然后画出题目想让我们完成的功能,就如上图所示
然后一次将每个模块测试没有问题就开始写界面
界面采用的思路自顶向下的想法
- 按键s4 对应
interfance = ~interfance - 然后先写
datainterfance - 然后用按键s5进行mode的切换,将数据界面的三个界面都写完整,测试一下,就进行参数界面的书写了
- 由于all参数要在退出参数界面后才生效,所以调整参数的副本,退出界面时,将所有参数副本赋值给real_index
- 然后完善按键s8和s9,同时完善参数界面,差不多就写完了
最后就看led想怎么亮
我一般是在其他地方判断led到底亮不亮,然后最后再来总了判断哪亮哪不亮。
void ledcmd()
{
if(liangan == 1) //an
{
led(led1+led2*2+led3*4|0x01<<(led_index-1));
}
else
{
led(led1+led2*2+led3*4);
}
}
有关
“若判断环境处于“暗”状态,且持续时间超过 3 秒,指示灯 L3 点亮;环 境处于“亮”状态,且持续时间超过 3 秒,指示灯 L3 熄灭”
我是想下面这么写的count_flag2反正就起一个技术,一旦亮暗发生变化,count= 0,重新计数的这样的想法,来判断led的亮灭
if(count_flag1)
{
count_an++;
if(count_an>3000) led3 = 1;
}
if(count_flag2)
{
count_liang++;
if(count_liang>3000) led3 = 0;
}
if(count % 200 == 0) {
light = r_light(); if(light<10) {
liangan = 1;count_flag1 = 1;count_liang = 0;} else {
liangan = 0;count_an = 0;count_flag2 = 1;}}
题目到这就写完了…除开测试好的的各个功能模块,差不多剩下的1h就可以搞定
边栏推荐
猜你喜欢

MATLAB中stairs函数使用

ArrayList automatic capacity expansion principle

The reason why scanf return value is ignored and its solution

深度学习与CV教程(14) | 图像分割 (FCN,SegNet,U-Net,PSPNet,DeepLab,RefineNet)

套接字编程Udp篇

读mysql45讲-自我总结(部分)

Signal relay rxsf1-rk271018dc110v

AcWing 41. Stack containing min function (monotone stack)

Building 64 bit wampserver and DVWA in win7 virtual machine

^34 scope interview questions
随机推荐
基于QT的旅行查询与模拟系统
AI - face
Distributed storage exploration
Thinking about the cooperation process of Network Library -- Some Thoughts on reading brpc
NLP data set download address for naturallanguageprocessing
M-Arch(番外12)GD32L233评测-CAU加解密(捉弄下小编)
InfoQ geek media's 15th anniversary solicitation |position:fixed virtual button cannot take effect after being triggered. Problem analysis and Solution Exploration
AcWing 128. Editor (to effectively modify the specified position in the top stack)
Pytorch笔记
Reading mysql45 lecture - self summary (part)
C# 36. DataGridView行号
LVS基于应用层的健康状态检测
SharDingJDBC-5.1.0按月水平分表+读写分离,自动创表、自动刷新节点表
tensorflow 2. X multi classification confusion matrix and evaluation index calculation method (accuracy rate, recall rate, F1 score)
2022-06-11:注意本文件中,graph不是邻接矩阵的含义,而是一个二部图。 在长度为N的邻接矩阵matrix中,所有的点有N个,matrix[i][j]
Flex layout
DS18B20 digital thermometer (I) electrical characteristics, parasitic power supply mode and remote wiring
M-arch (fanwai 12) gd32l233 evaluation -cau encryption and decryption (tease Xiaobian)
Collation of common functions in JS
AcWing 135. 最大子序和(前缀和 + 单调队列求定长区间最小值)