当前位置:网站首页>【蓝桥杯单片机 国赛 第十一届】
【蓝桥杯单片机 国赛 第十一届】
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就可以搞定
边栏推荐
- AcWing 132. 小组队列(队列模拟题)
- 套接字编程TCP篇
- 人脸识别pip 安装dlib库失败
- Index query efficiency of MySQL
- arm交叉编译链下载地址
- AcWing 135. Maximum subsequence sum (prefix sum + monotone queue to find the minimum value of fixed length interval)
- Collation of common functions in JS
- 21 reasons why you need social media QR code
- C# 36. DataGridView行号
- SOT23(Small Outline Transistor)
猜你喜欢

DS18B20数字温度计 (一) 电气特性, 寄生供电模式和远距离接线

21 reasons why you need social media QR code

^33 variable promotion and function promotion interview questions

Using stairs function in MATLAB

Malicious code analysis practice - lab06-01 exe~Lab06-04. Exe dynamic analysis

网络的拓扑结构

Reading mysql45 lecture - self summary (part)

^33变量提升和函数提升面试题

Unity 连接 Microsoft SQLSERVER 数据库

MySQL45讲 01 | 基础架构:一条SQL查询语句是如何执行的?
随机推荐
AcWing 1921. 重新排列奶牛(环图)
MySQL锁查漏补缺
Verifiability and scarcity of NFT Digital Collections
自然语言处理nlp 数据集下载地址
M-Arch(番外12)GD32L233评测-CAU加解密(捉弄下小编)
Lambda表达式 | 浅解
Thinking about the cooperation process of Network Library -- Some Thoughts on reading brpc
人脸识别pip 安装dlib库失败
The difference between meta universe chain games and traditional games
ReentrantLock源码分析
AcWing 135. 最大子序和(前缀和 + 单调队列求定长区间最小值)
Common methods of string class
Arm cross compilation chain download address
selenium使用代理IP
(37) How bee uses different data source instances at the same time
The evil 203 in systemctl
AcWing 41. Stack containing min function (monotone stack)
Vite Basics
The most detailed explanation of the top ten levels of sqli labs platform
NFT数字藏品的可验证性和稀缺性