我试图使用Arduino的MySQL连接器库,但我甚至无法编译第一个示例程序,因为sha1不断收到以下错误,我不明白为什么:
" GetFileAttributesEx H:\ Arduino \ libraries \ sha1 \ sha1.cpp H:\ Arduino \ libraries \ sha1 \ sha1.h:文件名,目录名或卷标语法不正确。 编译错误。"
我刚刚从https://launchpad.net/mysql-arduino下载了zip文件,并将两个文件夹(mysql_connector和sha1复制到Arduino / libraries)。
以下是我使用的代码:
/**
* Example: Hello, MySQL!
*
* This code module demonstrates how to create a simple
* database-enabled sketch.
*/
#include "SPI.h"
#include "Ethernet.h"
#include "sha1.h"
#include "mysql.h"
/* Setup for Ethernet Library */
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr(31, 170, 160, 100);
/* Setup for the Connector/Arduino */
Connector my_conn; // The Connector/Arduino reference
char user[] = "a5758541_Ark";
char password[] = "vini1020";
void setup() {
Ethernet.begin(mac_addr);
Serial.begin(115200);
while (!Serial);
delay(1000);
Serial.println("Connecting...");
if (my_conn.mysql_connect(server_addr , 3306, user, password)){
Serial.println("Success!");
} else {
Serial.println("Connection failed.");
}
}
void loop() {
}