金牌会员
- 积分
- 1229
- 金钱
- 1229
- 注册时间
- 2012-8-4
- 在线时间
- 248 小时
|
手环上的芯片有nrf51822+adxl345+w25Q16+tp4057+oled(0.66')+si2303(驱动电机的),板载一个j-link-ob,其他看图吧,程序传一个测试hex吧,只焊了2块板子,(^-^)挂在淘宝了,手机端在写,有没有有兴趣的网友<span style="background-color:#DFC5A4;">交流一下</span><span style="color:#E53333;background-color:#DFC5A4;">android</span><span style="background-color:#DFC5A4;">编程和nrf51822蓝牙通信</span>吧<br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#E56600;">峰值检测</span><span style="background-color:#E56600;"></span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;">if (Y > data_high) //如果现有数据比之前最大的大</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;">{</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> data_high = Y; //记录最新最大值</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> data_low = Y; //初始化最小值</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;">}</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;">else //出现了下坡</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> { </span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> data_time = data_time + 1; //开始记录步时间</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> if (Y < data_low) //最小的最大数据</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> data_low = Y; //记录最小数据</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> else //当新数据比最小数据大 即是已经出现峰值了</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> {</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> if ( (data_high - Y) > dirr ) //判断是否蜂刺</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> {</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> if(data_time >time_low & data_time <time_high)//判断时间</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> {</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> step_num = step_num + 1 ; //记录步数</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> oled_display_num(step_num);</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> }</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> data_time = 0; //时间归零 </span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> data_high = Y; //初始化最大值</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> data_low = Y; //初始化最小值</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> }</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;"> }</span><br />
<span style="color:#444444;font-family:Tahoma, Helvetica, SimSun, sans-serif;font-size:12px;line-height:18px;background-color:#EEEEEE;">}</span><br />
|
|