Go Down

Topic: Problem by controlling application with Arduino! (Read 834 times) previous topic - next topic


Hello everyone!I would like to help me to something...I have connected a sensor to the input all ok and all good... and i want to read values of the sensor for every 10 minutes.In the meanwhile i want to have the choice between the 10min time to send a choice from a C# application to retrieve these values.The problem has to do with the Arduino's source code, and more specific to the part that i should send the choice....To continue!After that if user for this 10min time didn't send any command for value display,the arduino should continue check as before...

Any idea please??Thanks a lot!


What your asking makes no sense after reading your post 3 times can you clarify the task you are trying to preform?


May 13, 2012, 03:04 am Last Edit: May 13, 2012, 03:07 am by sirus Reason: 1
I want to read in every ten minutes one sensor and sending a character which print these values to an C# application...The command which accepts from serialport is serial.read();
The controller stucks here and i don't want something like that.I want to continues read...When the user didn't send command to retrieve values the Arduin's software should continues reading in every 10 minutes.

Code: [Select]

   if( millis() >= (10UL*60UL*1000UL) && (!isPressed))
      //read values again if 10 minutes has completed
      //and the user didn't press 'l'
   else if( isPressed ){
     byte serialData = Serial.read();    
     if ((char)serialData =='l')  {      
      //sent data to C# app
     else {
     //something else      


i think it's best to let the timing be done byt the arduino... if you let it send something every 10 minutes, and you write your program so that it reads when something gets sent, then there should be no problem


The way your code is written now, nothing will happen for 10 minutes. After 10 minutes, the if statement will always be true.

I see no practical reason to not read the sensor on every pass through loop. You are only sending data to the C# application when it asks for it. Why does it matter that the data is current, rather than 10 minutes old?
The art of getting good answers lies in asking good questions.

Go Up