目录
方案策划
前言
2023电赛结束,这篇文章记录一下自己的实现方案与反思其中的仍可改进部分,能力的限制,四天三夜真正开始有进展时间就已经只剩下了一天了,只做完了基础部分,实现效果在电赛评比阶段基础部分满分拿下,结果为省二。
本文章会简述在电赛期间的所有设想与验证方式(由于竞赛期间并未考虑写这篇文章,因此很多数据与图片都是电赛后拍摄采集的),旨在对思路方法的分析与改进,本人三本末流院校,技术与思路十分不堪,如果没有什么帮助,推荐去hub上瞅一瞅。
一、题目简述
题目要求在指定大小的亚克力板作为测试平台,四个指定大小边角位置为检测装置与发射装置布置区域(Z区域),基础部分要求能预留接口以验证系统检测声音信号(信号要求为15khz至20khz频率步进为1khz的扫频信号)。在中心指定大小区域为敲击区域(M区域),要求划分为6x6大小共36个检测点位,通过显示设备显示敲击的36中点位的具体点位(通过题目指定编号进行显示)。
二、成果展示
三、实现方案
1.声电转换与信号发生
在题目发出第一次审题时便多次出现了声电电声转换部件。本题目相对于去年的音源定位题目而言,传播介质由空气转变为固体传播,咪头明显并不使用与固体传播的应用情况,我们也并未使用此传感器进行试验,进而由固体震动联想到压电传感器原理(由压电片形变从而产生电信号)。
在采取了压电传感器后对其灵敏度与实际应用效果进行了测试(使用arduino uno平台测试)
![](https://i-blog.csdnimg.cn/blog_migrate/047835fa312636eb4be2105c2102c282.jpeg)
![](https://i-blog.csdnimg.cn/blog_migrate/8127964211a92f9f1cc0355eddb0d46a.jpeg)
压电陶瓷传感测试
测试结果发现该传感器能够读取到由音频产生的震动数据。而单片机读取到的模拟量数值呈现出了读取量少,分辨率低的情况。经过对于arduino的推测得出可能是因为程序运行模式为转换ad信号后立即通过串口通信发送,而串口通信需要调用时钟通信占用大量程序时间。因此需要测试ad转换速率究竟如何,以下 程序为测试在一秒时间内的ad转换次数,最后得出为8910次转换,每次转换大约耗时112us,根据《建筑外墙敲击声音振动特征分析》(知网)可得敲击声音大约可持续0.02至0.04秒,期间可ad转换约200-400次左右,分辨率完全够用。
在第一问的指定频率声音产生上可以使用NE555制作,但要对频率一段时间后更改却不好实现,,思路为可以使用信号发生器产生所需信号,然后通过功率放大器链接扬声器单元产生所需声波。
#include <MsTimer2.h>
int dat;
unsigned long lop;
void fun()
{
Serial.println(lop);
lop=0;
}
void setup() {
// put your setup code here, to run once:
pinMode(A0,INPUT);
Serial.begin(9600);
MsTimer2 :: set(1000,fun);
MsTimer2 :: start();
}
void loop() {
// put your main code here, to run repeatedly:
//Serial.print(lop);
dat=analogRead(A0);
lop++;
}
2.信号分析
方案策划
//方案策划为按时间描述的对该题目的分析与实践,最终实行方案请看下一节
在采集到信号之后就是对与信号该如何进行分析的问题了。
对于声音信号波形的分析可以实现对声音的采集、预处理、特征提取、分类、合成、增强和编码等操作。
根据题目要求为分析敲击点位置来分析。可以将敲击点视为声音发生点,通过四个边角得到的声音信号来进行识别声音发生点位置。也就是说我们需要分析在不同敲击点敲击时四个边角位置所接受到的信号是否有特征。根据声音传播特性要分析声音在空间中位置,那只能去识别声音传播速度或声音衰弱值来判断具体空间位置。
在布置并连接了四个边角的声电传感器后,开始进行测试后发觉了一个十分重要的问题:
根据上文单个arduino uno的ad转换采集声音波形约为200-400个点数据,但如果同时采集四个ad数据,那么单个信号只能采集到50-100个点数据,导致单通道数据分辨率大大下降。
于是为了实现采集更多的波形数据,采用了四块arduino uno来进行采集数据,通过串口通信在采集信息后将数据发送至一块arduino上进行分析。由于本方案考虑的是分析声音在传播途中的声音衰弱来分析不同的声音波形区分敲击点位,默认是同一时间收集到信号,除一号机外其他机器延迟机器编号(四块arduino分为ID1,2,3,4)单位时间后发送至一号机进行集中处理,由此解决了波形分辨率不够的问题。
![](https://i-blog.csdnimg.cn/blog_migrate/350d448cf33bc8605c67a2c2561a5044.jpeg)
搭建完成后对于声音波形的分许却出现了问题,因为敲击角度力度还有回波的干扰等原因导致采集到的数据处于一个完全不可用的情况。由于平台搭建已经花费了大量的时间,于是在不改变搭建的情况下想到了另一个解决方案便是,将波形的最高点提取出来进行分析。
随后发现收信号的互相差值与不同振幅也就是敲击力度的大小关系很大,除非是完全一样的敲击,否则十分难以进行分析。
![](https://i-blog.csdnimg.cn/blog_migrate/2d6eb5044a107c4f37fa4aa43ee67557.png)
![](https://i-blog.csdnimg.cn/blog_migrate/fa7145348c50af3508d5b5d28764d4f3.jpeg)
进入此困境后,需要放松一下改变思路。在去钓了一条鱼之后,将思路进行了变更,从采集AD数值来分析波型变更为通过模块集成的比较器来采集收集到声音信号的一瞬间。从而通过分析声音的传播速度差来进行分析。由于四个主板组已经搭建完成,同时考虑到由于固体传播的因素加上每个相邻方格之间距离仅为5cm,而两个相邻方格距离最远的传感器仅有34cm的差值,于是我决定在原有基础上继续使用多mcu采集的方案,这个时候问题就开始出现了,由于每个单片机就算是同时上电启动,一样的程序,也不能保证能够使定时器同时开始定时,使用一个IO口拉高登待释放时开始同时计时可以使在头几个计时里比较稳定,往后还是会出现偏差,加上仅有34cm的差值,定时器的微小偏差也会使得整个系统出现毁灭性灾难
方案实行
由于以上情况加上经验不足,犯了很蠢的错误,就是在不确定可以使用该方案的情况下就继续优化方案。导致在此方案上花费了太多时间,在此也着重提醒大家,在进行方案实行前一定要多次分析是否方案可行。在搭建好后如果有更好方案或当前方案一直达不到预期,请立刻放弃该方案,不要因为已经搭建成功而继续使用,这样会浪费非常多的时间在这个最终很有可能不会使用的方案上。
在第一问的频率生成上并没有什么好的方法,最后采用了dds加功放的方式来产生每隔一段时间变化频率的音频信号。
![dds生成](https://i-blog.csdnimg.cn/direct/57b968a8a1714c83a4b5b64c645c8ebc.jpeg)
在识别敲击点位方面,对于Arduino定时器的分频为8,一个计时会持续2毫秒。Arduino使用的定时器是基于16MHz的系统时钟,而分频系数为8意味着每个计时周期需要8个时钟周期,因此一个计时周期为8 * (1 / 16MHz) = 0.5微秒。
在确定了定时器的最小分辨率后便可以进行初步判断可否对敲击范围进行判定,以下为声速在不同介质中的近似传播速度表。
以下声速为近似值
材料 | 声速 | |
Inch/µS | M/s | |
空气 | 0.013 | 330 |
铝 | 0.250 | 6300 |
矾土氧化物 | 0.390 | 9900 |
铍 | 0.510 | 12900 |
碳化硼 | 0.430 | 11000 |
黄铜 | 0.170 | 4300 |
镉 | 0.110 | 2800 |
铜 | 0.180 | 4700 |
玻璃 | 0.210 | 5300 |
甘油 | 0.075 | 1900 |
金 | 0.130 | 3200 |
冰 | 0.160 | 4000 |
铬镍铁合金 | 0.220 | 5700 |
铁 | 0.230 | 5900 |
铁(铸铁) | 0.180 | 4600 |
铅 | 0.085 | 2200 |
镁 | 0.230 | 5800 |
水银 | 0.057 | 1400 |
钼 | 0.250 | 6300 |
蒙乃尔(铜镍合金) | 0.210 | 5400 |
氯丁橡胶 | 0.063 | 1600 |
镍 | 0.220 | 5600 |
尼龙,6.6 | 0.100 | 2600 |
油(SAE 30) | 0.067 | 1700 |
白金 | 0.130 | 3300 |
有机玻璃 | 0.110 | 1700 |
聚乙烯 | 0.070 | 1900 |
聚苯乙烯 | 0.0930 | 2400 |
聚氨酯 | 0.0700 | 1900 |
石英 | 0.230 | 5800 |
橡胶,丁基合成橡胶 | 0.070 | 1800 |
银 | 0.140 | 3600 |
钢,低碳钢 | 0.230 | 5900 |
钢,不锈钢 | 0.230 | 5800 |
特氟隆 | 0.060 | 1400 |
锡 | 0.130 | 3300 |
钛 | 0.240 | 6100 |
钨 | 0.200 | 5200 |
铀 | 0.130 | 3400 |
水 | 0.584 | 1480 |
锌 | 0.170 | 4200 |
根据声速在亚克力板(有机玻璃)中的传播速度为1700m每秒,那么在不同方格中的5cm差值传播时间约为30us。定时器0.5us的计时周期可以说是绰绰有余。因此我们将振动传感器固定后就开始了测试。首先通过对同一点位进行多次敲击采集数据来判断是否可以对该点位采集到一个固定特性的数据,随后通过对两个不同点位进行多次敲击来确定是否可以通过这个固定特性来对不同的点位进行特征识别。
![](https://i-blog.csdnimg.cn/direct/9bed7f1d76ab402ba1f33cc0854447eb.png)
由于考虑到要采集四个位置的数据,因此每个中断的运行时间不易过长,因此定时器中断函数中仅放置了将定时器计时数据导出的程序,在等待四个定时器数据均导出至全局变量后再使用串口输出函数向电脑输出数据,以免产生较大误差。在将单点敲击数据汇总后(如上图),由于数据为计时器原始数据无参考性质,因此我们将各个传感器的点位原始数据相减得出特征值k1,k2,k3,k4后。可以观测到数据有明显规律,在进行多次敲击同一点位并计算出特征值后将数据汇总后某点位k1特征值可得出下表。
![](https://i-blog.csdnimg.cn/direct/17c43eb82c70479daa7abc5514a0fb11.png)
可观测到k1特征值明显具有特征性。并且十分明显,只需对其他数据进行检测并验证是否符合特征便可将该点特征值录入系统进行识别。
最终结果(部分)
33283 | 33283 | 131 | -201 | 97 | 27.00 | 2 | 58570 | 58570 | 203 | -46 | 22 | 3 | 9857 | 9857 | -82 | 184 | -128 | -26.00 | 四个数字采集处在图片的四个角 | 4 | 1299 | 1299 | -99 | -19 | -53 | -171.00 | 5 | |
19:56:35.352 -> 33152 | 33152 | 20:05:23.372 -> 58367 | 58367 | 20:09:28.649 -> 9939 | 9939 | 三个采集点,一组四个数据,四个数据是根据时差采集的 | 左上 | 21:13:30.131 -> 1398 | 1398 | 右下 | ||||||||||||||||||
19:56:35.352 -> 33353 | 33353 | 20:05:23.372 -> 58413 | 58413 | 20:09:28.649 -> 9755 | 9755 | 要分析出采集点 | 21:13:30.131 -> 1417 | 1417 | ||||||||||||||||||||
19:56:35.352 -> 33256 | 33256 | 20:05:23.372 -> 58391 | 58391 | 20:09:28.649 -> 9883 | 9883 | 21:13:30.131 -> 1470 | 1470 | |||||||||||||||||||||
35473 | 35473 | 127 | -144 | 47 | 30.00 | 19018 | 19018 | 125 | -54 | 24 | 31498 | 31498 | -21 | 147 | -101 | 25.00 | 6923 | 6923 | -111 | -9 | -51 | -171.00 | ||||||
19:56:58.447 -> 35346 | 35346 | 20:05:52.027 -> 18893 | 18893 | 20:09:45.222 -> 31519 | 31519 | 21:14:00.814 -> 7034 | 7034 | |||||||||||||||||||||
19:56:58.447 -> 35490 | 35490 | 20:05:52.068 -> 18947 | 18947 | 20:09:45.264 -> 31372 | 31372 | 21:14:00.814 -> 7043 | 7043 | |||||||||||||||||||||
19:56:58.447 -> 35443 | 35443 | 20:05:52.068 -> 18923 | 18923 | 20:09:45.264 -> 31473 | 31473 | 21:14:00.814 -> 7094 | 7094 | |||||||||||||||||||||
50729 | 50729 | 134 | -208 | 72 | -2.00 | 640 | 640 | 245 | -48 | 22 | 5700 | 5700 | -21 | 146 | -105 | 20.00 | 31784 | 31784 | -95 | -24 | -51 | -170.00 | ||||||
19:57:16.033 -> 50595 | 50595 | 20:06:09.816 -> 395 | 395 | 20:10:07.418 -> 5721 | 5721 | 21:14:17.706 -> 31879 | 31879 | |||||||||||||||||||||
19:57:16.065 -> 50803 | 50803 | 20:06:09.816 -> 443 | 443 | 20:10:07.418 -> 5575 | 5575 | 21:14:17.706 -> 31903 | 31903 | |||||||||||||||||||||
19:57:16.065 -> 50731 | 50731 | 20:06:09.816 -> 421 | 421 | 20:10:07.460 -> 5680 | 5680 | 21:14:17.706 -> 31954 | 31954 | |||||||||||||||||||||
11149 | 11149 | 135 | -210 | 103 | 28.00 | 28750 | 28750 | 126 | -48 | 21 | 2540 | 2540 | -24 | 152 | -105 | 23.00 | 4795 | 4795 | -116 | -2 |
| -173.00 | ||||||
19:57:34.772 -> 11014 | 11014 | 20:06:34.058 -> 28624 | 28624 | 20:10:26.026 -> 2564 | 2564 | 21:14:34.103 -> 4911 | 4911 | |||||||||||||||||||||
19:57:34.772 -> 11224 | 11224 | 20:06:34.058 -> 28672 | 28672 | 20:10:26.026 -> 2412 | 2412 | 21:14:34.103 -> 4913 | 4913 | |||||||||||||||||||||
19:57:34.772 -> 11121 | 11121 | 20:06:34.058 -> 28651 | 28651 | 20:10:26.070 -> 2517 | 2517 | 21:14:34.150 -> 4968 | 4968 | |||||||||||||||||||||
57971 | 57971 | 132 | -205 | 100 | 27.00 | 50456 | 50456 | 126 | -54 | 25 | 19626 | 19626 | -23 | 151 | -105 | 23.00 | 2323 | 2323 | -96 | -23 | -50 | -169.00 | ||||||
19:57:52.817 -> 57839 | 57839 | 20:06:56.961 -> 50330 | 50330 | 20:10:50.491 -> 19649 | 19649 | 21:14:50.874 -> 2419 | 2419 | |||||||||||||||||||||
19:57:52.817 -> 58044 | 58044 | 20:06:56.961 -> 50384 | 50384 | 20:10:50.491 -> 19498 | 19498 | 21:14:50.919 -> 2442 | 2442 | |||||||||||||||||||||
19:57:52.817 -> 57944 | 57944 | 20:06:56.961 -> 50359 | 50359 | 20:10:50.491 -> 19603 | 19603 | 21:14:50.919 -> 2492 | 2492 | |||||||||||||||||||||
14587 | 14587 | 137 | -209 | 76 | 4.00 | 5700 | 5700 | 60 | -49 | 20 | 33864 | 33864 | -23 | 147 | -102 | 22.00 | 44839 | 44839 | -74 | -30 | -25 | -129.00 | ||||||
20:01:53.925 -> 14450 | 14450 | 20:07:25.876 -> 5640 | 5640 | 20:11:13.639 -> 33887 | 33887 | 21:15:09.437 -> 44913 | 44913 | |||||||||||||||||||||
20:01:53.925 -> 14659 | 14659 | 20:07:25.876 -> 5689 | 5689 | 20:11:13.639 -> 33740 | 33740 | 21:15:09.437 -> 44943 | 44943 | |||||||||||||||||||||
20:01:53.925 -> 14583 | 14583 | 20:07:25.876 -> 5669 | 5669 | 20:11:13.639 -> 33842 | 33842 | 21:15:09.437 -> 44968 | 44968 | |||||||||||||||||||||
30312 | 30312 | 135 | -208 | 75 | 2.00 | 27841 | 27841 | 60 | -3 | -25 | 59755 | 59755 | -22 | 150 | -103 | 25.00 | 20947 | 20947 | -97 | -24 | -12 | -133.00 | ||||||
20:02:18.085 -> 30177 | 30177 | 20:07:45.099 -> 27781 | 27781 | 20:11:36.826 -> 59777 | 59777 | 21:15:29.785 -> 21044 | 21044 | |||||||||||||||||||||
20:02:18.085 -> 30385 | 30385 | 20:07:45.140 -> 27784 | 27784 | 20:11:36.827 -> 59627 | 59627 | 21:15:29.785 -> 21068 | 21068 | |||||||||||||||||||||
20:02:18.085 -> 30310 | 30310 | 20:07:45.140 -> 27809 | 27809 | 20:11:36.827 -> 59730 | 59730 | 21:15:29.785 -> 21080 | 21080 | |||||||||||||||||||||
52523 | 52523 | 166 | -268 | 112 | 10.00 | 8951 | 8951 | 62 | -7 | -23 | 47621 | 47621 | -10 | 115 | -101 | 4.00 | 43773 | 43773 | -95 | -25 | -50 | -170.00 | ||||||
20:03:11.957 -> 52357 | 52357 | 20:08:08.915 -> 8889 | 8889 | 20:12:17.137 -> 47631 | 47631 | 21:15:44.577 -> 43868 | 43868 | |||||||||||||||||||||
20:03:11.957 -> 52625 | 52625 | 20:08:08.915 -> 8896 | 8896 | 20:12:17.183 -> 47516 | 47516 | 21:15:44.577 -> 43893 | 43893 | |||||||||||||||||||||
20:03:11.957 -> 52513 | 52513 | 20:08:08.915 -> 8919 | 8919 | 20:12:17.183 -> 47617 | 47617 | 21:15:44.577 -> 43943 | 43943 | |||||||||||||||||||||
58116 | 58116 | 129 | -203 | 96 | 22.00 | 47291 | 47291 | 59 | -6 | -26 | 6026 | 6026 | -23 | 151 | -104 | 24.00 | 64872 | 64872 | -94 | -12 | -24 | -130.00 | ||||||
20:03:28.738 -> 57987 | 57987 | 20:08:44.993 -> 47232 | 47232 | 20:12:37.183 -> 6049 | 6049 | 21:17:13.571 -> 64966 | 64966 | |||||||||||||||||||||
20:03:28.738 -> 58190 | 58190 | 20:08:44.993 -> 47238 | 47238 | 20:12:37.183 -> 5898 | 5898 | 21:17:13.571 -> 64978 | 64978 | |||||||||||||||||||||
20:03:28.782 -> 58094 | 58094 | 20:08:44.993 -> 47264 | 47264 | 20:12:37.183 -> 6002 | 6002 | 21:17:13.571 -> 65002 | 65002 | |||||||||||||||||||||
10727 | 10727 | 130 | -152 | 46 | 24.00 | 26063 | 26063 | 64 | -9 | -20 | 53797 | 53797 | -24 | 146 | -101 | 21.00 | 49830 | 49830 | -98 | -19 | -54 | -171.00 | ||||||
20:04:01.336 -> 10597 | 10597 | 20:09:06.399 -> 25999 | 25999 | 20:12:58.873 -> 53821 | 53821 | 21:17:28.425 -> 49928 | 49928 | |||||||||||||||||||||
20:04:01.336 -> 10749 | 10749 | 20:09:06.399 -> 26008 | 26008 | 20:12:58.873 -> 53675 | 53675 | 21:17:28.469 -> 49947 | 49947 | |||||||||||||||||||||
20:04:01.336 -> 10703 | 10703 | 20:09:06.444 -> 26028 | 26028 | 20:12:58.873 -> 53776 | 53776 | 21:17:28.469 -> 50001 | 50001 | |||||||||||||||||||||
56284 | 56284 | 131 | -151 | 48 | 28.00 | 4669 | 4669 | 38 | -6 | -22 | 23313 | 23313 | -21 | 145 | -99 | 25.00 | 49988 | 49988 | -101 | -19 | -55 | -175.00 | ||||||
20:14:43.278 -> 56153 | 56153 | 20:39:16.161 -> 4631 | 4631 | 20:46:57.528 -> 23334 | 23334 | 21:17:43.907 -> 50089 | 50089 | |||||||||||||||||||||
20:14:43.278 -> 56304 | 56304 | 20:39:16.161 -> 4637 | 4637 | 20:46:57.528 -> 23189 | 23189 | 21:17:43.907 -> 50108 | 50108 | |||||||||||||||||||||
20:14:43.278 -> 56256 | 56256 | 20:39:16.161 -> 4659 | 4659 | 20:46:57.528 -> 23288 | 23288 | 21:17:43.907 -> 50163 | 50163 | |||||||||||||||||||||
47789 | 47789 | 130 | -149 | 46 | 27.00 | 63622 | 63622 | 7 | -2 | -24 | 45379 | 45379 | -40 | 144 | -99 | 5.00 | 43309 | 43309 | -98 | -25 | -52 | -175.00 | ||||||
20:15:07.374 -> 47659 | 47659 | 20:39:29.514 -> 63615 | 63615 | 20:47:25.675 -> 45419 | 45419 | 21:17:57.251 -> 43407 | 43407 | |||||||||||||||||||||
20:15:07.374 -> 47808 | 47808 | 20:39:29.514 -> 63617 | 63617 | 20:47:25.675 -> 45275 | 45275 | 21:17:57.251 -> 43432 | 43432 | |||||||||||||||||||||
20:15:07.374 -> 47762 | 47762 | 20:39:29.514 -> 63641 | 63641 | 20:47:25.675 -> 45374 | 45374 | 21:17:57.295 -> 43484 | 43484 | |||||||||||||||||||||
1362 | 1362 | 135 | -207 | 74 | 2.00 | 702 | 702 | 38 | -4 | -23 | 31435 | 31435 | -6 | 112 | -98 | 8.00 | 44364 | 44364 | -113 | -8 | -55 | -176.00 | ||||||
20:31:18.559 -> 1227 | 1227 | 20:39:43.945 -> 664 | 664 | 20:47:42.405 -> 31441 | 31441 | 21:20:02.365 -> 44477 | 44477 | |||||||||||||||||||||
20:31:18.559 -> 1434 | 1434 | 20:39:43.945 -> 668 | 668 | 20:47:42.405 -> 31329 | 31329 | 21:20:02.365 -> 44485 | 44485 | |||||||||||||||||||||
20:31:18.559 -> 1360 | 1360 | 20:39:43.945 -> 691 | 691 | 20:47:42.405 -> 31427 | 31427 | 21:20:02.365 -> 44540 | 44540 | |||||||||||||||||||||
25357 | 25357 | 131 | -153 | 46 | 24.00 | 4948 | 4948 | -1 | 4 | 11 | 10291 | 10291 | -22 | 147 | -101 | 24.00 | 31981 | 31981 | -99 | -18 | -53 | -170.00 | ||||||
20:31:43.060 -> 25226 | 25226 | 20:39:58.618 -> 4949 | 4949 | 20:48:03.024 -> 10313 | 10313 | 21:21:09.440 -> 32080 | 32080 | |||||||||||||||||||||
20:31:43.061 -> 25379 | 25379 | 20:39:58.618 -> 4945 | 4945 | 20:48:03.067 -> 10166 | 10166 | 21:21:09.440 -> 32098 | 32098 | |||||||||||||||||||||
20:31:43.061 -> 25333 | 25333 | 20:39:58.663 -> 4934 | 4934 | 20:48:03.067 -> 10267 | 10267 | 21:21:09.482 -> 32151 | 32151 | |||||||||||||||||||||
60684 | 60684 | 130 | -151 | 46 | 25.00 | 27216 | 27216 | 1 | 3 | 11 | 58460 | 58460 | -39 | 146 | -99 | 8.00 | 51456 | 51456 | -78 | -29 | -26 | -133.00 | ||||||
20:32:08.102 -> 60554 | 60554 | 20:40:15.000 -> 27215 | 27215 | 20:48:19.481 -> 58499 | 58499 | 21:21:28.402 -> 51534 | 51534 | |||||||||||||||||||||
20:32:08.102 -> 60705 | 60705 | 20:40:15.000 -> 27212 | 27212 | 20:48:19.481 -> 58353 | 58353 | 21:21:28.402 -> 51563 | 51563 | |||||||||||||||||||||
20:32:08.147 -> 60659 | 60659 | 20:40:15.000 -> 27201 | 27201 | 20:48:19.524 -> 58452 | 58452 | 21:21:28.402 -> 51589 | 51589 | |||||||||||||||||||||
2397 | 2397 | 133 | -154 | 49 | 28.00 | 36432 | 36432 | 29 | 2 | -27 | 8197 | 8197 | -10 | 113 | -98 | 5.00 | 58193 | 58193 | -109 | -12 | -50 | -171.00 | ||||||
20:32:26.771 -> 2264 | 2264 | 20:40:32.322 -> 36403 | 36403 | 20:48:46.054 -> 8207 | 8207 | 21:22:45.287 -> 58302 | 58302 | |||||||||||||||||||||
20:32:26.771 -> 2418 | 2418 | 20:40:32.322 -> 36401 | 36401 | 20:48:46.054 -> 8094 | 8094 | 21:22:45.287 -> 58314 | 58314 | |||||||||||||||||||||
20:32:26.771 -> 2369 | 2369 | 20:40:32.322 -> 36428 | 36428 | 20:48:46.054 -> 8192 | 8192 | 21:22:45.287 -> 58364 | 58364 | |||||||||||||||||||||
27409 | 27409 | 125 | -149 | 43 | 19.00 | 58830 | 58830 | 34 | -2 | -24 | 7548 | 7548 | -24 | 152 | -105 | 23.00 | 63761 | 63761 | -97 | -24 | -52 | -173.00 | ||||||
20:32:44.674 -> 27284 | 27284 | 20:41:32.729 -> 58796 | 58796 | 20:49:04.379 -> 7572 | 7572 | 21:22:12.772 -> 63858 | 63858 | |||||||||||||||||||||
20:32:44.719 -> 27433 | 27433 | 20:41:32.729 -> 58798 | 58798 | 20:49:04.422 -> 7420 | 7420 | 21:22:12.772 -> 63882 | 63882 | |||||||||||||||||||||
20:32:44.719 -> 27390 | 27390 | 20:41:32.729 -> 58822 | 58822 | 20:49:04.422 -> 7525 | 7525 | 21:22:12.772 -> 63934 | 63934 | |||||||||||||||||||||
43424 | 43424 | 125 | -145 | 44 | 24.00 | 63974 | 63974 | 5 | 2 | -29 | 62063 | 62063 | -40 | 150 | -102 | 8.00 | 56607 | 56607 | -97 | -25 | -11 | -133.00 | ||||||
20:33:15.438 -> 43299 | 43299 | 20:42:15.792 -> 63969 | 63969 | 20:49:21.905 -> 62103 | 62103 | 21:23:51.113 -> 56704 | 56704 | |||||||||||||||||||||
20:33:15.438 -> 43444 | 43444 | 20:42:15.792 -> 63967 | 63967 | 20:49:21.950 -> 61953 | 61953 | 21:23:51.113 -> 56729 | 56729 | |||||||||||||||||||||
20:33:15.438 -> 43400 | 43400 | 20:42:15.792 -> 63996 | 63996 | 20:49:21.950 -> 62055 | 62055 | 21:23:51.113 -> 56740 | 56740 | |||||||||||||||||||||
56707 | 56707 | 126 | -146 | 44 | 24.00 | 37379 | 37379 | 9 | -2 | -24 | 63361 | 63361 | -8 | 111 | -98 | 5.00 | 45807 | 45807 | -106 | -11 | -48 | -165.00 | ||||||
20:33:30.197 -> 56581 | 56581 | 20:42:37.414 -> 37370 | 37370 | 20:49:52.368 -> 63369 | 63369 | 21:24:33.552 -> 45913 | 45913 | |||||||||||||||||||||
20:33:30.197 -> 56727 | 56727 | 20:42:37.458 -> 37372 | 37372 | 20:49:52.368 -> 63258 | 63258 | 21:24:33.552 -> 45924 | 45924 | |||||||||||||||||||||
20:33:30.197 -> 56683 | 56683 | 20:42:37.458 -> 37396 | 37396 | 20:49:52.368 -> 63356 | 63356 | 21:24:33.552 -> 45972 | 45972 | |||||||||||||||||||||
10756 | 10756 | 136 | -210 | 104 | 30.00 | 7935 | 7935 | 7 | -2 | -12 | 61018 | 61018 | -21 | 148 | -101 | 26.00 | 16699 | 16699 | -110 | -8 | -51 | -169.00 | ||||||
20:34:10.637 -> 10620 | 10620 | 20:42:50.178 -> 7928 | 7928 | 20:50:07.812 -> 61039 | 61039 | 21:24:47.856 -> 16809 | 16809 | |||||||||||||||||||||
20:34:10.637 -> 10830 | 10830 | 20:42:50.178 -> 7930 | 7930 | 20:50:07.812 -> 60891 | 60891 | 21:24:47.856 -> 16817 | 16817 | |||||||||||||||||||||
20:34:10.679 -> 10726 | 10726 | 20:42:50.178 -> 7942 | 7942 | 20:50:07.812 -> 60992 | 60992 | 21:24:47.856 -> 16868 | 16868 | |||||||||||||||||||||
21927 | 21927 | 138 | -212 | 72 | -2.00 | 4048 | 4048 | 3 | 2 | 12 | 50524 | 50524 | -10 | 115 | -100 | 5.00 | 8533 | 8533 | -115 | -4 | -55 | -174.00 | ||||||
20:34:31.652 -> 21789 | 21789 | 20:43:02.464 -> 4045 | 4045 | 20:50:24.308 -> 50534 | 50534 | 21:25:06.708 -> 8648 | 8648 | |||||||||||||||||||||
20:34:31.697 -> 22001 | 22001 | 20:43:02.464 -> 4043 | 4043 | 20:50:24.308 -> 50419 | 50419 | 21:25:06.708 -> 8652 | 8652 | |||||||||||||||||||||
20:34:31.697 -> 21929 | 21929 | 20:43:02.464 -> 4031 | 4031 | 20:50:24.308 -> 50519 | 50519 | 21:25:06.708 -> 8707 | 8707 | |||||||||||||||||||||
63076 | 63076 | 129 | -151 | 47 | 25.00 | 6563 | 6563 | 3 | 1 | -11 | 4101 | 4101 | -39 | 147 | -99 | 9.00 | 46111 | 46111 | -94 | -27 | -10 | -131.00 | ||||||
20:34:48.366 -> 62947 | 62947 | 20:43:24.791 -> 6560 | 6560 | 20:50:39.829 -> 4140 | 4140 | 21:25:22.840 -> 46205 | 46205 | |||||||||||||||||||||
20:34:48.366 -> 63098 | 63098 | 20:43:24.791 -> 6559 | 6559 | 20:50:39.875 -> 3993 | 3993 | 21:25:22.840 -> 46232 | 46232 | |||||||||||||||||||||
20:34:48.366 -> 63051 | 63051 | 20:43:24.791 -> 6570 | 6570 | 20:50:39.875 -> 4092 | 4092 | 21:25:22.840 -> 46242 | 46242 | |||||||||||||||||||||
63462 | 63462 | 129 | -150 | 46 | 25.00 | 58840 | 58840 | 5 | -3 | 14 | 33582 | 33582 | -22 | 146 | -100 | 24.00 | 11112 | 11112 | -94 | -24 | -12 | -130.00 | ||||||
20:35:21.156 -> 63333 | 63333 | 20:43:37.835 -> 58835 | 58835 | 20:50:57.277 -> 33604 | 33604 | 21:26:26.678 -> 11206 | 11206 | |||||||||||||||||||||
20:35:21.156 -> 63483 | 63483 | 20:43:37.835 -> 58838 | 58838 | 20:50:57.277 -> 33458 | 33458 | 21:26:26.723 -> 11230 | 11230 | |||||||||||||||||||||
20:35:21.156 -> 63437 | 63437 | 20:43:37.835 -> 58824 | 58824 | 20:50:57.277 -> 33558 | 33558 | 21:26:26.723 -> 11242 | 11242 | |||||||||||||||||||||
62043 | 62043 | 132 | -154 | 47 | 25.00 | 49374 | 49374 | 4 | -2 | 14 | 49523 | 49523 | -42 | 152 | -105 | 5.00 | 27232 | 27232 | -107 | -12 | -48 | -167.00 | ||||||
20:35:36.341 -> 61911 | 61911 | 20:43:53.548 -> 49370 | 49370 | 20:51:08.357 -> 49565 | 49565 | 21:26:48.509 -> 27339 | 27339 | |||||||||||||||||||||
20:35:36.341 -> 62065 | 62065 | 20:43:53.548 -> 49372 | 49372 | 20:51:08.357 -> 49413 | 49413 | 21:26:48.552 -> 27351 | 27351 | |||||||||||||||||||||
20:35:36.341 -> 62018 | 62018 | 20:43:53.548 -> 49358 | 49358 | 20:51:08.357 -> 49518 | 49518 | 21:26:48.552 -> 27399 | 27399 | |||||||||||||||||||||
6857 | 6857 | 112 | -150 | 46 | 8.00 | 55535 | 55535 | 33 | -1 | -26 | 11713 | 11713 | -23 | 149 | -105 | 21.00 | 43887 | 43887 | -114 | -4 | -57 | -175.00 | ||||||
20:35:53.445 -> 6745 | 6745 | 20:44:09.032 -> 55502 | 55502 | 20:51:26.550 -> 11736 | 11736 | 21:27:53.088 -> 44001 | 44001 | |||||||||||||||||||||
20:35:53.445 -> 6895 | 6895 | 20:44:09.032 -> 55503 | 55503 | 20:51:26.550 -> 11587 | 11587 | 21:27:53.132 -> 44005 | 44005 | |||||||||||||||||||||
20:35:53.445 -> 6849 | 6849 | 20:44:09.032 -> 55529 | 55529 | 20:51:26.596 -> 11692 | 11692 | 21:27:53.132 -> 44062 | 44062 | |||||||||||||||||||||
46675 | 46675 | 127 | -146 | 46 | 27.00 | 32334 | 32334 | 7 | -2 | -10 | 22636 | 22636 | -23 | 147 | -101 | 23.00 | 58675 | 58675 | -97 | -21 | -53 | -171.00 | ||||||
20:36:12.987 -> 46548 | 46548 | 20:44:24.131 -> 32327 | 32327 | 20:51:50.482 -> 22659 | 22659 | 21:28:13.113 -> 58772 | 58772 | |||||||||||||||||||||
20:36:12.987 -> 46694 | 46694 | 20:44:24.175 -> 32329 | 32329 | 20:51:50.482 -> 22512 | 22512 | 21:28:13.113 -> 58793 | 58793 | |||||||||||||||||||||
20:36:13.031 -> 46648 | 46648 | 20:44:24.175 -> 32339 | 32339 | 20:51:50.482 -> 22613 | 22613 | 21:28:13.113 -> 58846 | 58846 | |||||||||||||||||||||
6197 | 6197 | 125 | -146 | 44 | 23.00 | 28684 | 28684 | 9 | -4 | -24 | 23649 | 23649 | -8 | 112 | -98 | 6.00 | 64630 | 64630 | -112 | -7 | -52 | -171.00 | ||||||
20:36:27.007 -> 6072 | 6072 | 20:44:38.836 -> 28675 | 28675 | 20:52:02.551 -> 23657 | 23657 | 21:28:29.912 -> 64742 | 64742 | |||||||||||||||||||||
20:36:27.007 -> 6218 | 6218 | 20:44:38.836 -> 28679 | 28679 | 20:52:02.551 -> 23545 | 23545 | 21:28:29.912 -> 64749 | 64749 | |||||||||||||||||||||
20:36:27.007 -> 6174 | 6174 | 20:44:38.836 -> 28703 | 28703 | 20:52:02.551 -> 23643 | 23643 | 21:28:29.912 -> 64801 | 64801 | |||||||||||||||||||||
24791 | 24791 | 130 | -149 | 49 | 30.00 | 51644 | 51644 | 2 | 4 | 12 | 25652 | 25652 | -42 | 148 | -101 | 5.00 | 37249 | 37249 | -114 | -5 | -54 | -173.00 | ||||||
20:36:40.726 -> 24661 | 24661 | 20:44:52.562 -> 51642 | 51642 | 20:52:16.944 -> 25694 | 25694 | 21:28:46.825 -> 37363 | 37363 | |||||||||||||||||||||
20:36:40.726 -> 24810 | 24810 | 20:44:52.562 -> 51638 | 51638 | 20:52:16.990 -> 25546 | 25546 | 21:28:46.868 -> 37368 | 37368 | |||||||||||||||||||||
20:36:40.726 -> 24761 | 24761 | 20:44:52.562 -> 51626 | 51626 | 20:52:16.990 -> 25647 | 25647 | 21:28:46.868 -> 37422 | 37422 | |||||||||||||||||||||
16000 | 16000 | 125 | -147 | 44 | 22.00 | 34432 | 34432 | 4 | 2 | -28 | 51088 | 51088 | -9 | 114 | -100 | 5.00 | 44409 | 44409 | -99 | -19 | -53 | -171.00 | ||||||
20:37:06.394 -> 15875 | 15875 | 20:45:07.149 -> 34428 | 34428 | 20:52:32.546 -> 51097 | 51097 | 21:29:03.638 -> 44508 | 44508 | |||||||||||||||||||||
20:37:06.394 -> 16022 | 16022 | 20:45:07.192 -> 34426 | 34426 | 20:52:32.546 -> 50983 | 50983 | 21:29:03.685 -> 44527 | 44527 | |||||||||||||||||||||
20:37:06.394 -> 15978 | 15978 | 20:45:07.192 -> 34454 | 34454 | 20:52:32.546 -> 51083 | 51083 | 21:29:03.685 -> 44580 | 44580 | |||||||||||||||||||||
26822 | 26822 | 133 | -210 | 101 | 24.00 | 5085 | 5085 | 5 | -2 | -11 | 15631 | 15631 | -23 | 145 | -100 | 22.00 | 24422 | 24422 | -108 | -11 | -53 | -172.00 | ||||||
20:37:29.223 -> 26689 | 26689 | 20:45:24.111 -> 5080 | 5080 | 20:52:47.864 -> 15654 | 15654 | 21:29:17.737 -> 24530 | 24530 | |||||||||||||||||||||
20:37:29.223 -> 26899 | 26899 | 20:45:24.111 -> 5082 | 5082 | 20:52:47.864 -> 15509 | 15509 | 21:29:17.737 -> 24541 | 24541 | |||||||||||||||||||||
20:37:29.269 -> 26798 | 26798 | 20:45:24.111 -> 5093 | 5093 | 20:52:47.908 -> 15609 | 15609 | 21:29:17.737 -> 24594 | 24594 | |||||||||||||||||||||
52751 | 52751 | 129 | -150 | 46 | 25.00 | 7557 | 7557 | 9 | -3 | -24 | 16650 | 16650 | -40 | 148 | -102 | 6.00 | 17997 | 17997 | -113 | -5 | -53 | -171.00 | ||||||
20:37:45.608 -> 52622 | 52622 | 20:45:47.724 -> 7548 | 7548 | 20:53:01.761 -> 16690 | 16690 | 21:29:34.519 -> 18110 | 18110 | |||||||||||||||||||||
20:37:45.608 -> 52772 | 52772 | 20:45:47.724 -> 7551 | 7551 | 20:53:01.761 -> 16542 | 16542 | 21:29:34.519 -> 18115 | 18115 | |||||||||||||||||||||
20:37:45.608 -> 52726 | 52726 | 20:45:47.724 -> 7575 | 7575 | 20:53:01.804 -> 16644 | 16644 | 21:29:34.519 -> 18168 | 18168 |
将一组数据写入程序进行检测验证结果展示
23电赛测试成果 |
最终代码 |
// 引入Arduino库
#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
int K1,K2,K3,K4;
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library.
// On an arduino UNO: A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO: 2(SDA), 3(SCL), ...
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define NUMFLAKES 10 // Number of snowflakes in the animation example
#define ID 1
// 定义中断触发的引脚
#define INTERRUPT_PIN 2
//int ready=0;
// 定义定时器1的寄存器指数
volatile unsigned long timer1Time;
volatile unsigned long timer1Time2;
volatile unsigned long timer1Time3;
volatile unsigned long timer1Time4;
int print=0;
// 中断服务函数
void interruptHandler() {
// 读取定时器1的计数值
timer1Time = TCNT1;
//TCNT1 = 0;
// ready=0;
// 复位定时器1的计数值
// print =1;
/*
if(ready)
{
print =1;
}
else {TCNT1 = 0; ready = 1; delay(400*ID); Serial.println("system,ready");}
*/
}
void interruptHandler2() {
// 读取定时器1的计数值
timer1Time2 = TCNT1;
//TCNT1 = 0;
// ready=0;
// 复位定时器1的计数值
/*
if(ready)
{
print =1;
}
else {TCNT1 = 0; ready = 1; delay(400*ID); Serial.println("system,ready");}
*/
}
void interruptHandler3() {timer1Time3 = TCNT1;}
void interruptHandler4() {timer1Time4 = TCNT1; print =1; }
void setup() {
// 初始化串口通信
Serial.begin(9600);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
display.display();
//delay(2000); // Pause for 2 seconds
display.clearDisplay();
display.drawPixel(10, 10, SSD1306_WHITE);
display.display();
delay(2000);
pinMode(3,INPUT);
// 配置2号引脚为输入
pinMode(INTERRUPT_PIN, INPUT);
pinMode(18, INPUT);
pinMode(19, INPUT);
// 配置定时器1
TCCR1A = 0; // 清除计时器1的控制寄存器A
TCCR1B = 0; // 清除计时器1的控制寄存器B
// 配置计时器1为正常模式
// TCCR1A |= (0 << WGM10) | (0 << WGM11);
// TCCR1B |= (0 << WGM12) | (0 << WGM13);
TCCR1B |= (1 << CS11) | (1 << CS10) ;
// 配置计时器1的时钟源为外部下降沿触发
//TCCR1B |= (1 << CS10) | (0 << CS11) | (1 << CS12);
// 启用定时器1的溢出中断
//TIMSK1 |= (1 << TOIE1);
// 配置中断触发
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), interruptHandler, RISING);
attachInterrupt(digitalPinToInterrupt(3), interruptHandler2, RISING);
attachInterrupt(digitalPinToInterrupt(18), interruptHandler3, RISING);
attachInterrupt(digitalPinToInterrupt(19), interruptHandler4, RISING);
}
void screem(int a,int b)
{
display.setTextSize(3);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0,0);
if(a==1)display.print("AB");
else
{if(a==2)display.print("CD");
else
if(a==3)display.print("EF");
else
if(a==4)display.print("GH");
else
if(a==5)display.print("IJ");
else
if(a==6)display.print("KL");}
if(b==1)display.print(",0102");
else
{if(b==2)display.print(",0304");
else
if(b==3)display.print(",0506");
else
if(b==4)display.print(",0708");
else
if(b==5)display.print(",0910");
else
if(b==6)display.print(",1112");}
delay(10);
yield();
display.display();
}
void loop() {
// 读取定时器1的时间并输出
//if (Serial.available()) {
// 读取串口接收到的数据
// int receivedData = Serial.parseInt();
// 打印接收到的数据
if(print)
{
delay (500*ID);
//Serial.println("begin");
K1=timer1Time-timer1Time2;
K2=timer1Time2-timer1Time3;
K3=timer1Time3-timer1Time4;
K4=timer1Time-timer1Time4;
/*
Serial.println(K1);
Serial.println(K2);
Serial.println(K3);
Serial.println(K4);
*/
// 定义目标数据数组和可调误差范围
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
int targetK1Data[] = {12, 15, 0, -116, 80, 100, 25, -75, 0, 40, -35, 8, 0, 0, 0, -25, -50, 15, 65, 124, 70, 195, 0, -65, -50, 0, 4, 0, 104, 53, 23, 22, 38, 170, 69, 59, 37};
int targetK2Data[] = {1, 15, 110, 0, 0, 0, -105, 35, -130, 0, 80, 93, -20, -10, 1, 40, 0, -88, -160, -170, -120, 44, 35, -123, 40, 40, 59, -48, 27, -93, -46, -6, 0, -120, -90, -50, 0};
int targetK3Data[] = {1, 15, -110, 0, 85, 20, 0, 0, 70, 87, -140, 0, 0, 0, -80, 0, 0, 0, 4, 0, 99, 43, -25, 93, -47, -103, -98, -6, -36, 0, 0, -4, 0, -25, 28, 40, 64};
int targetK4Data[] = {1, 15, 0, -180, 200, 150, -95, 0, 0, 110, 0, 30, 5, -45, 0, -90, -120, -64, 0, 40, 110, 290, 60, -92, 0, 0, 0, -53, 116, 0, 0, 24, 78, 65, 0, 64, 97};
//
int targetK1Dat[] = {14, 15, 0, -94, 150, 181, 55, -65, 170, 100, -30, 35, 0, 0, 0, -21, -40, 25, 100, 324, 120, 200, 0, -40, -20, 0, 8, 0, 143, 85, 60, 30, 93, 190, 164, 100, 62};
int targetK2Dat[] = {1, 15, 170, 0, 0, 0, -88, 40, -90, -41, 100, 120, 35, -5, 43, 50, 0, -80, -100, 153, -120, 57, 90, -117, 50, 70, 76, -38, 53, -76, -38, 4, 0, -75, -80, -37, 0};
int targetK3Dat[] = {1, 15, -100, 0, 120, 40, 0, 0, 78, 120, -80, 0, 0, 0, -50, 0, 0, 0, 14, 0, 100, 75, -10, 84, -40, -50, -83, -1, -16, 0, 0, 4, 0, 20, 36, 53, 76};
int targetK4Dat[] = {1, 15, 0, -160, 265, 250, -40, 0, 0, 200, 0, 45, 30, -5, 0, -30, -114, -56, 0, 140, 174, 405, 80, -70, 0, 0, 0, -46, 140, 0, 0, 31, 140, 90, 0, 106, 125};
#define ERROR_RANGE 5
// 使用循环和if语句判断指数是否在目标数据数组中,并带有可调误差范围
int i;
int index = -1; // 初始化数组编号为-1,表示不在目标数据数组中
// 同时判断K1、K2、K3和K4的指数是否在目标数据数组中
for (i = 0; i < sizeof(targetK1Data) / sizeof(targetK1Data[0]); i++) {
if (((K1 >= targetK1Data[i] - ERROR_RANGE && K1 <= targetK1Dat[i] + ERROR_RANGE) || targetK1Data[i]==0 ) &&
((K2 >= targetK2Data[i] - ERROR_RANGE && K2 <= targetK2Dat[i] + ERROR_RANGE) || targetK2Data[i]==0 ) &&
((K3 >= targetK3Data[i] - ERROR_RANGE && K3 <= targetK3Dat[i] + ERROR_RANGE) || targetK3Data[i]==0 ) &&
((K4 >= targetK4Data[i] - ERROR_RANGE && K4 <= targetK4Dat[i] + ERROR_RANGE) || targetK4Data[i]==0 )) {
index = i;
break;
}
}
// 输出结果
if (index != -1) {
if(i==2){ display.clearDisplay();
display.display();screem(6,1);}
if(i==3){ display.clearDisplay();
display.display();screem(1,1);}
Serial.println("success");Serial.println(i);
if(i==4){ display.clearDisplay();
display.display();screem(6,6);}
Serial.println("success");Serial.println(i);
if(i==5){ display.clearDisplay();
display.display();screem(6,4);}
Serial.println("success");Serial.println(i);
if(i==6){ display.clearDisplay();
display.display();screem(1,4);}
Serial.println("success");Serial.println(i);
if(i==7){ display.clearDisplay();
display.display();screem(3,1);}
Serial.println("success");Serial.println(i);
if(i==8){ display.clearDisplay();
display.display();screem(3,6);}
Serial.println("success");Serial.println(i);
if(i==9){ display.clearDisplay();
display.display();screem(5,6);}
Serial.println("success");Serial.println(i);
if(i==10){ display.clearDisplay();
display.display();screem(5,1);}
Serial.println("success");Serial.println(i);
if(i==11){ display.clearDisplay();
display.display();screem(6,2);}
Serial.println("success");Serial.println(i);
if(i==12){ display.clearDisplay();
display.display();screem(4,3);}
Serial.println("success");Serial.println(i);
if(i==13){ display.clearDisplay();
display.display();screem(3,3);}
Serial.println("success");Serial.println(i);
if(i==14){ display.clearDisplay();
display.display();screem(2,1);}
Serial.println("success");Serial.println(i);
if(i==15){ display.clearDisplay();
display.display();screem(4,1);}
Serial.println("success");Serial.println(i);
if(i==16){ display.clearDisplay();
display.display();screem(1,2);}
Serial.println("success");Serial.println(i);
if(i==17){ display.clearDisplay();
display.display();screem(1,3);}
Serial.println("success");Serial.println(i);
if(i==18){ display.clearDisplay();
display.display();screem(1,5);}
Serial.println("success");Serial.println(i);
if(i==19){ display.clearDisplay();
display.display();screem(2,6);}
Serial.println("success");Serial.println(i);
if(i==20){ display.clearDisplay();
display.display();screem(4,6);}
Serial.println("success");Serial.println(i);
if(i==21){ display.clearDisplay();
display.display();screem(6,5);}
Serial.println("success");Serial.println(i);
if(i==22){ display.clearDisplay();
display.display();screem(6,3);}
Serial.println("success");Serial.println(i);
if(i==23){ display.clearDisplay();
display.display();screem(2,2);}
Serial.println("success");Serial.println(i);
if(i==24){ display.clearDisplay();
display.display();screem(3,2);}
Serial.println("success");Serial.println(i);
if(i==25){ display.clearDisplay();
display.display();screem(4,2);}
Serial.println("success");Serial.println(i);
if(i==26){ display.clearDisplay();
display.display();screem(5,2);}
Serial.println("success");Serial.println(i);
if(i==27){ display.clearDisplay();
display.display();screem(2,3);}
Serial.println("success");Serial.println(i);
if(i==28){ display.clearDisplay();
display.display();screem(5,3);}
Serial.println("success");Serial.println(i);
if(i==29){ display.clearDisplay();
display.display();screem(2,4);}
Serial.println("success");Serial.println(i);
if(i==30){ display.clearDisplay();
display.display();screem(3,4);}
Serial.println("success");Serial.println(i);
if(i==31){ display.clearDisplay();
display.display();screem(4,4);}
Serial.println("success");Serial.println(i);
if(i==32){ display.clearDisplay();
display.display();screem(5,4);}
Serial.println("success");Serial.println(i);
if(i==33){ display.clearDisplay();
display.display();screem(2,5);}
Serial.println("success");Serial.println(i);
if(i==34){ display.clearDisplay();
display.display();screem(3,5);}
Serial.println("success");Serial.println(i);
if(i==35){ display.clearDisplay();
display.display();screem(4,5);}
Serial.println("success");Serial.println(i);
if(i==36){ display.clearDisplay();
display.display();screem(5,5);}
Serial.println("success");Serial.println(i);
}else{
display.clearDisplay();
display.display(); Serial.println("fail");Serial.println(i); Serial.println(K1);Serial.println(K2);Serial.println(K3);Serial.println(K4);
}
//Serial.println(timer1Time4);
print=0;
//ready=0;
}
}
/*
Serial.println(timer1Time);
Serial.println(timer1Time2);
Serial.println(timer1Time3);
Serial.println(timer1Time4);
*/