Hi everybody,
I need your help on the following setup:
On the arduino side, I have an UNO with an ethershield and the MySQL Connector/Arduino from MySQL Connector/Arduino in Launchpad
I have striped down the code for simplification and I try to connect and insert just two rows of data into the database
#include <SPI.h>
#include <Ethernet.h>
#include <sha1.h>
#include <avr/pgmspace.h>
#include <stdlib.h>
#include <mysql.h>
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr(10,0,1,54);
char user[] = "admin";
char password[] = "abcd";
Connector my_conn; // The Connector/Arduino reference
const char INSERT_TEXT[] = "INSERT INTO joomladb.meteo VALUES ('Hello, MySQL!', NULL)";
const char INSERT_DATA[] = "INSERT INTO joomladb.meteo VALUES (%s, NULL)";
void setup() {
Ethernet.begin(mac_addr);
Serial.begin(9600);
delay(1000);
Serial.println("Connecting...");
if (my_conn.mysql_connect(server_addr, 3306, user, password)) {
delay(1000);
}
else
Serial.println("Connection failed.");
//
// INSERT Examples
//
my_conn.cmd_query(INSERT_TEXT);
// Now, let's check our results.
char query[64];
char temperature[10];
dtostrf(value_read, 1, 1, temperature);
sprintf(query, INSERT_DATA, temperature);
my_conn.cmd_query(query);
}
void loop() {
}
On the PC side I have installed XAMPP distribution setup with the MySQL, PHPAdmin and Joomla.
I haven't done anything special here, other than adding the user=admin with the password mentioned above with PHP admin into MySQL.
When running the UNO it stacks in "Connecting..." and no records are added into MySQL. Looking in MySQL log (from XAMPP control panel) I see that it finds the data base but it has not presented all the qualification right to connect.
I think that something is wrong on MySQL side and PHPadmin and I am novice to this. Can somebody help me? HAs anyone done it with this XAMPP distribution before? Any setup suggestions are welcome. Thanks.