I have difficulty sending texts to the mysql server, the 'status' field is receiving numbers instead of the text "no humidity"
this is my code:
#define pinsensorA A0
#define pinsensorD 8
#include <Ethernet.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
char query[128];
int leitura;
char str0 = "sem umidade";
char str1 = "com umidade";
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr(X,X,X,X); // IP of the MySQL server here
char user[] = "guilherme7"; // MySQL user login username
char password[] = "local1108"; // MySQL user login password
// Sample query
char INSERT_SQL[] = "INSERT INTO umidade.teste (DEVICE_ID, NIVEL_UMIDADE, STATUS) VALUES ('1', '%d', '%d')";
EthernetClient client;
MySQL_Connection conn((Client *)&client);
void setup() {
Serial.begin(115200);
while (!Serial); // wait for serial port to connect
Ethernet.begin(mac_addr);
Serial.println("Connecting...");
if (conn.connect(server_addr, 3306, user, password)) {
delay(1000);
}
else
Serial.println("Connection failed.");
}
void loop() {
delay(2000);
if (analogRead(pinsensorA) > 700) {
leitura = analogRead(pinsensorA);
sprintf (query, INSERT_SQL, leitura, str0);
// Initiate the query class instance
MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
// Execute the query
cur_mem->execute(query);
// Note: since there are no results, we do not need to read any data
// Deleting the cursor also frees up memory used
delete cur_mem;
}
}

