欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
MEGA2560主控自行車騎行監(jiān)測器源碼
[打印本頁]
作者:
水韻竹風(fēng)
時(shí)間:
2017-12-24 15:20
標(biāo)題:
MEGA2560主控自行車騎行監(jiān)測器源碼
自行車騎行監(jiān)測器,可以GPS定位,檢測騎行速度,檢測心率,同時(shí)將以上數(shù)據(jù)寫入SD卡內(nèi)進(jìn)行保存,使用MEGA2560主控
SD卡的SPI接口 ** MOSI - pin 51 ** MISO - pin 50 ** CLK - pin 52 ** CS - pin 53
GPS的串口使用mega2560的串口1 Serial 1: Pin19 (RX) and Pin18 (TX);Pin13接一個LED顯示GPS是否工作正常
兩個霍爾傳感器接在外部中斷 Pin2 (interrupt 0), Pin3 (interrupt 1)
心跳指示燈在 Pin5 int fadePin = 5
int blinkPin = 14;
0.png
(11.92 KB, 下載次數(shù): 88)
下載附件
2017-12-25 23:54 上傳
單片機(jī)源程序如下:
//#include"Arduino.h"
//#include "AllSerialHanding.h"
//#include "Interrupt.h"
//#include "SD_ReadWrite.h"
#include "all.h"
#define PROCESSING_VISUALIZER 1
#define SERIAL_PLOTTER 2
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded!
static int outputType = SERIAL_PLOTTER;
String beat_data = " BPM:0 IBI:0 Signal:0";
void PulseSensor_SD_Write()
{
SD_Write("test.txt",beat_data); //脈沖數(shù)據(jù)寫入SD卡中PulseSensor.txt文件
}
// Sends Data to Pulse Sensor Processing App, Native Mac App, or Third-party Serial Readers.
void sendDataToSerial(char symbol, int data ){
Serial.print(symbol);
Serial.println(data);
}
void serialOutput(){ // Decide How To Output Serial.
switch(outputType){
case PROCESSING_VISUALIZER:
sendDataToSerial('S', Signal); // goes to sendDataToSerial function
break;
case SERIAL_PLOTTER: // open the Arduino Serial Plotter to visualize these data
Serial.print(BPM);
Serial.print(",");
Serial.print(IBI);
Serial.print(",");
Serial.println(Signal);
beat_data=" BPM:"+String(BPM)+" IBI:"+String(IBI)+" Signal:"+String(Signal);
break;
default:
break;
}
}
// Decides How To OutPut BPM and IBI Data
void serialOutputWhenBeatHappens(){
switch(outputType){
case PROCESSING_VISUALIZER: // find it here https://github.com/WorldFamousElectronics/PulseSensor_Amped_Processing_Visualizer
sendDataToSerial('B',BPM); // send heart rate with a 'B' prefix
sendDataToSerial('Q',IBI); // send time between beats with a 'Q' prefix
break;
default:
break;
}
}
// SET THE SERIAL OUTPUT TYPE TO YOUR NEEDS
// PROCESSING_VISUALIZER works with Pulse Sensor Processing Visualizer
// https://github.com/WorldFamousElectronics/PulseSensor_Amped_Processing_Visualizer
// SERIAL_PLOTTER outputs sensor data for viewing with the Arduino Serial Plotter
// run the Serial Plotter at 115200 baud: Tools/Serial Plotter or Command+L
void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}
void Pulse_Init(){
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
// Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
// IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE BOARD VOLTAGE,
// UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF PIN
// analogReference(EXTERNAL);
}
// Where the Magic Happens
void Pulse_Allot(){
serialOutput() ;
if (QS == true){ // A Heartbeat Was Found
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
自行車騎行監(jiān)測器.zip
(11.53 KB, 下載次數(shù): 10)
2017-12-24 15:18 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1