Go Down

Topic: Using strcat to construct a variable URL/ adaptable url for php request (Read 10461 times) previous topic - next topic

C220amg

Sorry guys, I can't seem to get grip on my problem. I tried a new sketch which makes use of the SoftwareSerial library, which doesn't work at all.
Though, I keep thinking the problem of my combined sketch isn't to big, it looks like it only run's the void functions and ignores all the rest. 

PaulS

Quote
I tried a new sketch which makes use of the SoftwareSerial library, which doesn't work at all.

Using something other than 0 point font when you post the code would be good.

Quote
it looks like it only run's the void functions and ignores all the rest. 

So, use global variables, and make all the functions void. Not that that will help. Debug print statements and code reviews are what you really need.
The art of getting good answers lies in asking good questions.

C220amg

Oke, i tried to debug my code, which I've already posted in this topic. And I have found a bug, though no idea at all of how solve it.

It seems to be within my; void setup(){..}

which contains the following code.

Code: [Select]
  Serial.begin(9600);

  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  delay(2000);
  Serial.println("Ready");

  /////////////////RFID/////////////////
   
  pinMode(RFIDResetPin, OUTPUT);
  digitalWrite(RFIDResetPin, HIGH);

  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
 
  pinMode(connectedToServer, OUTPUT);
}


The problems seems to be with the
Code: [Select]
Ethernet.begin(mac,ip, gateway, gateway, subnet);
If i comment this line, it works fine. Except from making the connection. Any ideas of how to solve this?

Regards,
Niels

dxw00d

Code: [Select]
Ethernet.begin(mac, ip, gateway, gateway, subnet);

Where are the definitions/initialisations of those parameters?

C220amg


Code: [Select]
Ethernet.begin(mac, ip, gateway, gateway, subnet);

Where are the definitions/initialisations of those parameters?


Those are declared above the setup()

Code: [Select]
#include <SPI.h>
#include <Ethernet.h>

//Here Ethernet parameters
IPAddress ip(******************);
IPAddress gateway(******************);
IPAddress subnet(******************);
byte mac[] = {****************** };
IPAddress server(******************);




EthernetClient client;
int totalCount = 0;
int loopCount = 0;
int connectLed=5;
int buttonState=0;
int n;
int connectedToServer=6;


/////////////////RFID/////////////////
int RFIDResetPin = 13;
int rfid_val;
//Register your RFID tags here
char tag1[13] = "4500530E9F87";
char tag2[13] = "450052E8E51A";

int led1=2;
int led2=3;

void setup() {
  Serial.begin(9600);

  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  delay(2000);
  Serial.println("Ready");

  /////////////////RFID/////////////////
   
  pinMode(RFIDResetPin, OUTPUT);
  digitalWrite(RFIDResetPin, HIGH);

  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
 
  pinMode(connectedToServer, OUTPUT);
}

C220amg

Never mind! Finally got it working! The problem, was as I expected very very silly! I used pin 13 as reset for the RFID, though it is used for the ethernet shield.  :smiley-sweat:  :smiley-mr-green:

I would like to thank everyone who took the time to help me with my problems! I hope I haven't been a to big pain in the, well whatever!

Thanks guys!

Niels

Go Up