Hi All, i have an issue to transfer the data from Arduino to the pushing box.
seems like either my coding is having an error or maybe there is a better way to do it.
i’m using Arduino Uno r3, Ethernet Shield, RS232 and UHF Rfid for my project.
Below is my coding.
/* Arduino Code which sends data to google spreadsheet */
#include<SPI.h>
#include <Ethernet.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial (5, 6);
#define Sending_To_Spreadsheet;
String data;
unsigned char incomingByte;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "api.pushingbox.com/pushingbox?devid="; //YOUR SERVER
IPAddress ip(10, 30, 20, 95);
EthernetClient client;
int j = incomingByte;
void sendIdentifyCmd ()
{
mySerial.write (0x7c);
mySerial.write (0xff);
mySerial.write (0xff);
mySerial.write (0x01);
mySerial.write (0x08);
mySerial.write (0x7d);
#ifdef DEBUG
Serial.print (0x7c);
Serial.print (0xff);
Serial.print (0xff);
Serial.print (0x01);
Serial.print (0x08);
Serial.print (0x7d);
Serial.println ();
#endif
}
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
SPI.begin();
Serial.println ("begin initial Serial!\n");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
Ethernet.begin(mac, ip);
}
delay(1000);
Serial.println("connecting...");
}
void loop() {
{
sendIdentifyCmd ();
delay (2);
while (mySerial.available () > 0)
{
incomingByte = mySerial.read ();
Serial.print (incomingByte, HEX);
Serial.print (' ');
}
Serial.println ();
delay (1000);
}
void get_Data(); {
data += "";
data += "GET /pushingbox?devid=";
data == "HTTP/1.1";
}
void send_Data();
Serial.println("connected");
client.println(data);
client.println("Host:api.pushingbox.com");
void Sending_To_spreadsheet() ; //CONNECTING WITH MYSQL
{
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.print("GET /pushingbox?devid=");
}//YOUR URL
if (j == incomingByte)
{
client.print('1');
// Serial.print('1');
}
else
{
client.print('0');
}
client.print("&Member_ID=");
if (incomingByte)
{
client.print(incomingByte);
}
}
}