当前位置:网站首页>【蓝桥杯单片机 国赛 第十一届】
【蓝桥杯单片机 国赛 第十一届】
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就可以搞定
边栏推荐
- 读mysql45讲-自我总结(部分)
- Reading mysql45 lecture - self summary (part)
- AcWing 135. 最大子序和(前缀和 + 单调队列求定长区间最小值)
- ReentrantLock源码分析
- Don't swallow rice with vinegar! Teach you 2 moves to make the fish bones "run out" safely
- C# 36. DataGridView行号
- Flex layout
- UI自动化测试中比较少见的异常记录
- MATLAB中stairs函数使用
- Using stairs function in MATLAB
猜你喜欢

C# 35. 选择默认网卡

M-Arch(番外10)GD32L233评测-SPI驱动DS1302

AcWing 131. 直方图中最大的矩形(单调栈经典运用 模板)

人类想要拥有金钱、权力、美丽、永生、幸福……但海龟只想做一只海龟

MYSQL——内置函数

Don't swallow rice with vinegar! Teach you 2 moves to make the fish bones "run out" safely

人脸识别pip 安装dlib库失败

21 reasons why you need social media QR code

卡鱼刺别再喝醋吞米饭了!教你2招,让鱼刺安全“跑出来”

正则表达式 | 浅解
随机推荐
网络的拓扑结构
InfoQ 极客传媒 15 周年庆征文|position:fixed 虚拟按键触发后无法生效问题分析及解决方案探究
AI - face
890. find and replace mode
UI自动化测试中比较少见的异常记录
How to upload the video on the computer to the mobile phone without network
读mysql45讲-自我总结(部分)
正则表达式 | 浅解
Grid layout
ArrayList automatic capacity expansion principle
21 reasons why you need social media QR code
M-arch (fanwai 12) gd32l233 evaluation -cau encryption and decryption (tease Xiaobian)
FormatConversionTool.exe
Distributed storage exploration
自然语言处理nlp 数据集下载地址
k52.第一章 基于kubeadm安装kubernetes v1.22 -- 集群部署
Get all listening events in the element
卡鱼刺别再喝醋吞米饭了!教你2招,让鱼刺安全“跑出来”
AcWing 1912. 里程表(枚举)
K58. Chapter 1 installing kubernetes V1.23 based on kubeadm -- cluster deployment