DHCP Library Conflict X10 library

Hello!, I'm using Dhcp library to get IP directly from dhcp server. It works well.

However, when I include X10 library, X10 module does not work. It works fine when I use X10 only.

There is somehow confliction between these library.

Anyone knows why?

Thanks

Don't know the X-10 lib, but an educated guess is that they share some resource e.g. SPI pins?

Ethernet-shield uses pin 10 -13 (10 = Slave Select) No two SPI devices may be selected at the same time, don't know what the X-10 lib does,
but as the libs are open source you could dive into the code to see...

robtillaart:
Don't know the X-10 lib, but an educated guess is that they share some resource e.g. SPI pins?

Ethernet-shield uses pin 10 -13 (10 = Slave Select) No two SPI devices may be selected at the same time, don't know what the X-10 lib does,
but as the libs are open source you could dive into the code to see...

Thanks for your information.

When I look at the codes,

EthernetDHCP library calls SPI.h (#include <SPI.h>), but X10 dose not include SPI.h. In this case, can I say X10 libaray does not use SPI? Or do I have to look at the library?

Can you let me know which specific parts of codes indicate that it uses SPI?

I'm sorry if the questions are not clear.

Thanks

I don't see any SPI in the X10 files. But this may be the problem, as robtillaart suggested:

x10::x10(int zeroCrossingPin, int dataPin)
{
  this->zeroCrossingPin = zeroCrossingPin;      // the zero crossing pin
  this->dataPin = dataPin;        				// the output data pin
  
  // Set I/O modes:
  pinMode(this->zeroCrossingPin, INPUT);
  pinMode(this->dataPin, OUTPUT);
}

When you call x10(x,y), what are those values? In the examples I found, it is pins 2 and 3.

SurferTim:
I don't see any SPI in the X10 files. But this may be the problem, as robtillaart suggested:

x10::x10(int zeroCrossingPin, int dataPin)

{
  this->zeroCrossingPin = zeroCrossingPin;      // the zero crossing pin
  this->dataPin = dataPin;        // the output data pin
 
  // Set I/O modes:
  pinMode(this->zeroCrossingPin, INPUT);
  pinMode(this->dataPin, OUTPUT);
}




When you call x10(x,y), what are those values? In the examples I found, it is pins 2 and 3.

Hello!, I have tested it with pin 10 and 11, with pin 2 and 3. Both does not work if I use both library.

So you are saying that it may be work if I use pin 2 and 3?

Just in case,I will test it again

I also think that it may be caused from 'out of memory' since DHCP library shows high memory consumption.

It may be memory, but for certain you can't use pin 10 for x10. That is the SPI enable/disable pin for the ethernet SPI interface.
2 and 3 would be best.

What does the compiler report for memory when it finished compiling your code?

SurferTim:
It may be memory, but for certain you can't use pin 10 for x10. That is the SPI enable/disable pin for the ethernet SPI interface.
2 and 3 would be best.

What does the compiler report for memory when it finished compiling your code?

When I compile the codes, it shows that

'Binary sketch size: 14726 bytes (of a 32256 byte maximum)'

So, I have just turned back to the beginning to make sure the whole process, I'm wiring stuffs again. :cold_sweat:

You should have plenty of memory. You are using less than half.

I know it is a pain to rewire stuff :frowning: , but if the result is everything works, it is worth it. :slight_smile:

SurferTim:
You should have plenty of memory. You are using less than half.

I know it is a pain to rewire stuff :frowning: , but if the result is everything works, it is worth it. :slight_smile:

Yes, thanks for your support. It should not be the difficult and complicated as I thought at the first time. :stuck_out_tongue: