Hi there,
I have no idea on how to run 2 codes in 1 in order to get data via Gobetwino software.
1 code can be found in here: Tutorial: Reading Water Flow rate with Water Flow Sensor - #2 by ESP - Grove - Seeed Forum
and the other in here : Gadgets og teknologi | Dansk Tech Blog - Mikmo after downloading the program, under gobetwinoLogTest.pde file in samples folder. I also attach them in here.
My code looks like this, but I know there must be lots of mistakes because I have no idea on programing, I barely know the language what means each function and /or how to dispose it in the right secuence.
Can someone help me? I´m not pluggin it the sensors yet to check if it works, could this be another reason? When I run it I don´t get anything, its like Arduino board remain in standbymode.
thank´s
int serInLen = 25;
char serInString[25];
int sensorValue = analogRead(A1);
volatile int NbTopsFan;
int Calc;
int hallsensor = 2;
int logValue3=0;
int result;
void rpm ()
{
NbTopsFan++;
}
void setup()
{
pinMode(hallsensor, INPUT);
Serial.begin(9600);
attachInterrupt(0, rpm, RISING);
randomSeed(analogRead(0));
Serial.println("#S|CPTEST|[]#");
readSerialString(serInString,1000);
}
void loop()
{
int sensorValue = analogRead(A1);
float depth = sensorValue * (500 / 1023.0);
NbTopsFan = 0;
sei();
delay(1000);
cli();
Calc = (NbTopsFan * 60);
logValue3= random(0,1000);
logData(depth,Calc,logValue3);
}
void logData( int depth, int Calc, int value3)
{
char buffer[5];
Serial.print("#S|LOGTEST|[");
Serial.print(itoa((depth), buffer, 10));
Serial.print(";");
Serial.print(itoa((Calc), buffer, 10));
Serial.print(";");
Serial.print(itoa((value3), buffer, 10));
Serial.println("]#");
readSerialString(serInString,1000);
}
void readSerialString (char *strArray,long timeOut)
{
long startTime=millis();
int i;
while (!Serial.available()) {
if (millis()-startTime >= timeOut) {
return;
}
}
while (Serial.available() && i < serInLen) {
strArray[i] = Serial.read();
i++;
}
}
gobetwinoLogTest.pde (1.93 KB)
waterflow.ino (1.38 KB)