I need help on the coding

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);
    }
  }

}

Your topic has been moved to this forum section as this location is more relevant to the subject

You have not actually told us what the problem is. What happens when you try and run the sketch ? What were you expecting/hoping would happen.

You need to stop relying on “Good news code” and check the return values of functions and act accordingly. For example if the client does not connect, there is no point in trying to send anything, but it is worth reporting the problem.

I have no idea what a "pushbox" is.
Could you please describe on the functional level what your project does.

Does pushingbox.com have sample-codes how to do it?
Is your code derived from such a demo-code?

best regards Stefan

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.