Pessoal boa tarde tudo bem ?
Tenho um pouco de conhecimento do arduino, porém estou enfrentando sérias dificuldades para entender e implementar MYSQL + PHP + Arduino:
Hardware:
Arduino UNO
EtherCar HanRun HR911105A 14/16.
Fiz um código que recebe via GET, valores e insere no banco, até ai tudo certo. Porém não consigo fazer o aruino enviar essas
informações via GET/POST para meu "servidor localhost". Pegue o exemplo do ethercard (Segue abaixo), porém não consigo interpreta-lo,
isto é saber oque ele faz e como ele faz. Se alguém estiver disposto a me tirar algumas dúvidas agradeço.
Aonde declaro o IP do servidor?
Gostaria de inserir Gatway estático?
Gostaria de inserir DNS primário e secundário estático.?
Quais são os comandos que posso usar nessa biblioteca EtherCard.h,e pra que eles servem ?
Desde já agradeço e peço desculpa por alguma evetual gafe!
Segue código de exemplo:
[code]
// Demo using DHCP and DNS to perform a web client request.
// 2011-06-08
http://opensource.org/licenses/mit-license.php
#include
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "www.google.com";
// called when the client request is complete
static void my_callback (byte status, word off, word len) {
Serial.println(">>>");
Ethernet::buffer[off+300] = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");
}
void setup () {
Serial.begin(57600);
Serial.println(F("\n[webClient]"));
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("< REQ ");
ether.browseUrl(PSTR("/foo/"), "bar", website, my_callback);
}
}
[/code]