MySQL Forums
Forum List  »  Connector/Arduino

Re: I use MySQL connectorl and after some time it stops. PLEASE HELP
Posted by: César Sebastián Silva Proaño
Date: November 01, 2016 05:57AM

1) The reason why I make the calculation in Arduino is because it is difficult to perform calculation on the mySQL data base for example how should I operate this in a QUERY:


1 2 3 ?

If A >=10 then D = (B + C)/C
If A < 10 then D = (B - C) / C

That's why I need arduino code first to calculate these values and then translate them to the MySQL data base.

2) How much time of delay should I use for running every Query in the arduino code. Is this perhaps a reason of lock up when I use a very small delay time?

3) Should I use a delay after each Query request in the arduino sketch?

4) This is the way how I run a query on the arduino sketch:

void inputQueryTable1 () {
String InsertSQL_String_A = QueryTable1 + c1 + id + c1 + c2 + c1 + sensorValueVout1 + c1 + c2 + c1 + sensorValueVout2 + c1 + c2 + c1 + counterVout1HighNP + c1 + c2 + c1 + counterVout1LowYP + c1 + c2 + c1 + counterVout2HighNP + c1 + c2 + c1 + counterVout2LowYP + c1 + c3;
int length_InsertSQL_String_A = InsertSQL_String_A.length() + 1;
char InsertSQL_A [length_InsertSQL_String_A];
MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); // Initiate the query class instance
cur_mem->execute(InsertSQL_A); // Execute the query
delete cur_mem;

Is there a more simple way without creating the string value?

5) Is there a simple way to reconnect the arduino to the mySQL database posting some code in the sketch when the lock up occurs?

6) I am using an arduino atmega2560 and the moment that I run the program I have this message about the memory:
Sketch uses 8% of program storage space
Global variables use 22% of dynamic memory
Do I have a leak memory problem?

7) When I restart my arduino it starts sending data again to the mySQL database but from the first column deleting my previous data. Is there any way to start recording from the last column?

Sorry for the amount of questions but you are the only one that helps me in this. Unfortunatly I haven't received any help in the arduino forum.
I could have sent you an email but perhaps it is important to post this here so another person that has a problem similar to mine can take your advice.

Best regards,
And thank you so much for your time and help

Options: ReplyQuote

Written By
Re: I use MySQL connectorl and after some time it stops. PLEASE HELP
November 01, 2016 05:57AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.