sending the last 10 minute data via bluetooth

Thread Starter

farnaz201

Joined Nov 27, 2019
1
// this was for photocell data logging for 30 sec intervals, now i want to write a code which commands from the cellphone and sends back the last 10 minute data. at first i thought if i make an array of 20 buckets, and put it in a loop, then send the loop function to android would make it right, but it just sends me continues data. i only want the last 10 minute data of the program.


float sensorvalue[20];

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
for (int i = 0; i < 20; i++) {
pinMode(sensorvalue, OUTPUT);
}
}

void loop() {
// put your main code here, to run repeatedly:
sendvalues();
char c;

if(Serial.available())
{
c=Serial.read();
if (c=='t')
sendvalues();
}
}
void sendvalues(){
for (int i=0 ; i<20 ; i++){
Serial.println(sensorvalue);
sensorvalue = analogRead(A0);
delay(30000); //every 30 seconds read data

if (i>=20) {
i=0; //reset to beginning of array, so you don't try to save readings outside of the bounds of the array
} }
Serial.println("***********************************");
}
 
Last edited:
Top