极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 14252|回复: 5

帮我整合一个代码

[复制链接]
发表于 2017-10-26 17:46:11 | 显示全部楼层 |阅读模式

我想通过water传感器3个,和称重传感器Realplay+HX711模块称重传感器1个,同ARDUINO mega2560 、sd card shield v1.1(记录卡)、DS 1370 RTC(时间记录)、连接在一起,为的是实现将water传感器3个出现的数据和称重传感器Realplay+HX711模块称重传感器出来的数据,通过sd card shield v1.1(记录卡)记录,用DS 1370 RTC(时间记录)写入时间,water传感器3个的代码我已经写出:
// reading liquid flow rate using Seeeduino and Water Flow Sensor from hotmcu.com
// Code adapted by Charles Gantt from PC Fan RPM code written by Crenn @thebestcasescenario.com
// http:/themakersworkbench.com http://thebestcasescenario.com http://hotmcu.com

volatile int NbTopsFan1;                       // measuring the rising edges of the signal
volatile int NbTopsFan2;                       // measuring the rising edges of the signal
volatile int NbTopsFan3;                       // measuring the rising edges of the signal
int Calc1;
int Calc2;
int Calc3;
int hallsensor1 = 2;                           // The pin location of the sensor
int hallsensor2 = 4;                           // The pin location of the sensor
int hallsensor3 = 7;                           // The pin location of the sensor


void rpm ()                                   // This is the function that the interupt calls
{
    NbTopsFan1++;
    NbTopsFan2++;
    NbTopsFan3++;                             // This function measures the rising and falling edge of the hall effect sensors signal
}


void setup()
{
    pinMode(hallsensor1, INPUT);               // initializes digital pin 2 as an input
    pinMode(hallsensor2, INPUT);               // initializes digital pin 4 as an input
    pinMode(hallsensor3, INPUT);               // initializes digital pin 7 as an input
    Serial.begin(9600);                       // This is the setup function where the serial port is initialised,
    attachInterrupt(0, rpm, RISING);
    attachInterrupt(2, rpm, RISING);
    attachInterrupt(5, rpm, RISING);         // and the interrupt is attached
}


void loop ()
{
    NbTopsFan1 = 0;                            // Set NbTops to 0 ready for calculations
    NbTopsFan2 = 0;
    NbTopsFan3 = 0;
    sei();                                    // Enables interrupts
    delay (1000);                             // Wait 1 second
    cli();                                    // Disable interrupts

    Calc1 = (NbTopsFan1 * 60 / 4.5);            // (Pulse frequency x 60) / 4.5Q, = flow rate in L/hour
    Calc2 = (NbTopsFan2 * 60 / 4.5);            // (Pulse frequency x 60) / 4.5Q, = flow rate in L/hour
    Calc3 = (NbTopsFan3 * 60 / 4.5);            // (Pulse frequency x 60) / 4.5Q, = flow rate in L/hour

    Serial.print (Calc1, DEC);                 // Prints the number calculated above
    Serial.print (Calc2, DEC);                 // Prints the number calculated above
    Serial.print (Calc3, DEC);                 // Prints the number calculated above

    Serial.print (" L/hour\r\n");             // Prints "L/hour" and returns a  new line
}


称重传感器Realplay+HX711模块称重传感器的代码也有
sd card shield v1.1代码有
DS 1370 RTC(时间记录)代码
都在附件
我想大家能不能帮我把整个的代码给整合起来,谢谢各位!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复

使用道具 举报

发表于 2017-10-28 10:03:08 | 显示全部楼层
没实现吗?是什么问题?我可以帮你做
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-10-30 21:22:22 | 显示全部楼层
我是不太会再往下怎么弄,3个water传感器我已经写出来了,
再往下是把称重传感器Realplay+HX711程序写出来
再加上sd card shield v1.1(记录卡)、DS 1370 RTC(时间记录)的程序

要实现的是:3个water传感器、称重传感器Realplay+HX711模块称重传感器同时能够读取数据,把数据存到sd卡里,然后还得有时间
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-11-1 14:39:19 | 显示全部楼层
suoma 发表于 2017-10-28 10:03
没实现吗?是什么问题?我可以帮你做

您能帮我就太好了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-11-4 17:57:06 | 显示全部楼层
suoma 发表于 2017-10-28 10:03
没实现吗?是什么问题?我可以帮你做

您说应该怎么弄
回复 支持 反对

使用道具 举报

发表于 2017-11-4 21:19:34 | 显示全部楼层
lona21 发表于 2017-11-4 17:57
您说应该怎么弄

加QQ3455482668详聊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-23 23:46 , Processed in 0.046121 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表