Mit wenigen Kenntnissen, könnte man das RedBean ORM verwenden.
Da gibts ein REST Plugin.
Das kümmert sich um alle deine PHP-->zu-->DB Probleme, inclusive SQL Statement generierung, Tabellen und Spalten anlegen, usw.
Arduino: 1.8.3 (Windows 10), Board: "Arduino Nano, ATmega328"
In file included from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:35:0,
from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/utility/Enc28J60Network.h:102:8: warning: #warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'." [-Wcpp]
#warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'."
^
In file included from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPClient.h:37:0,
from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:41,
from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/utility/logging.h:24:2: warning: #warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage." [-Wcpp]
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
^
In file included from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:23:0,
from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/ethernet_comp.h:5:24: error: redefinition of 'class UIPClient'
#define EthernetClient UIPClient
^
D:\Programme\Arduino\libraries\Ethernet\src/EthernetClient.h:8:7: note: in expansion of macro 'EthernetClient'
class EthernetClient : public Client {
^
In file included from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:41:0,
from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPClient.h:75:9: error: previous definition of 'class UIPClient'
class UIPClient : public Client {
^
In file included from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:23:0,
from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/ethernet_comp.h:6:24: error: redefinition of 'class UIPServer'
#define EthernetServer UIPServer
^
D:\Programme\Arduino\libraries\Ethernet\src/EthernetServer.h:8:7: note: in expansion of macro 'EthernetServer'
class EthernetServer :
^
In file included from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:42:0,
from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPServer.h:42:9: error: previous definition of 'class UIPServer'
class UIPServer : public Server {
^
In file included from C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:23:0,
from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/ethernet_comp.h:4:18: error: conflicting declaration 'EthernetClass UIPEthernet'
#define Ethernet UIPEthernet
^
D:\Programme\Arduino\libraries\Ethernet\src/Ethernet.h:39:22: note: in expansion of macro 'Ethernet'
extern EthernetClass Ethernet;
^
In file included from C:\Users\SUPPER~1\AppData\Local\Temp\arduino_modified_sketch_593660\basic_insert.ino:40:0:
C:\Users\SupperCraft5000\Documents\Arduino\libraries\UIPEthernet/UIPEthernet.h:133:25: note: previous declaration as 'UIPEthernetClass UIPEthernet'
extern UIPEthernetClass UIPEthernet;
^
exit status 1
Fehler beim Kompilieren für das Board Arduino Nano.
Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.
Code
/*
MySQL Connector/Arduino Example : basic insert
This example demonstrates how to issue an INSERT query to store data in a
table. For this, we will create a special database and table for testing.
The following are the SQL commands you will need to run in order to setup
your database for running this sketch.
CREATE DATABASE test_arduino;
CREATE TABLE test_arduino.hello_arduino (
num integer primary key auto_increment,
message char(40),
recorded timestamp
);
Here we see one database and a table with three fields; a primary key that
is an auto_increment, a string, and a timestamp. This will demonstrate how
to save a date and time of when the row was inserted, which can help you
determine when data was recorded or updated.
INSTRUCTIONS FOR USE
1) Create the database and table as shown above.
2) Change the address of the server to the IP address of the MySQL server
3) Change the user and password to a valid MySQL user and password
4) Connect a USB cable to your Arduino
5) Select the correct board and port
6) Compile and upload the sketch to your Arduino
7) Once uploaded, open Serial Monitor (use 115200 speed) and observe
8) After the sketch has run for some time, open a mysql client and issue
the command: "SELECT * FROM test_arduino.hello_arduino" to see the data
recorded. Note the field values and how the database handles both the
auto_increment and timestamp fields for us. You can clear the data with
"DELETE FROM test_arduino.hello_arduino".
Note: The MAC address can be anything so long as it is unique on your network.
Created by: Dr. Charles A. Bell
*/
#include <UIPEthernet.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr(192,168,2,106); // IP of the MySQL *server* here
char user[] = "root"; // MySQL user login username
char password[] = "-"; // MySQL user login password
// Sample query
char INSERT_SQL[] = "INSERT INTO test_arduino.hello_arduino (message) VALUES ('Hello, Arduino!')";
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);
Serial.println("Recording data.");
// Initiate the query class instance
MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
// Execute the query
cur_mem->execute(INSERT_SQL);
// 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;
}
combie:
OK, ganz ohne PHP Kenntnisse wirds schwierig....
Mit wenigen Kenntnissen, könnte man das RedBean ORM verwenden.
Da gibts ein REST Plugin.
Das kümmert sich um alle deine PHP-->zu-->DB Probleme, inclusive SQL Statement generierung, Tabellen und Spalten anlegen, usw.
naja ich kann es ja mal damit versuchen. hast du da vtl einen link für wo ich das finde.