Bonjour,
Bon j'en ai marre de me coltiner ce problème, je galère a chaque fois avec ces histoires de CS à en croire qu'on peut pas utilisé la SD et ethernet en même temps..
Bon j'ai un arduino ethernet et je veux utilisé la SD et ethernet
j'ai vue sur le net les pint de CS sont 4 et 2 donc réspéctivement quand je commence le SD je fait:
pinMode(2, OUTPUT);// ethernet
digitalWrite(2,HIGH);// CS=1 désactivé
pinMode(4, INPUT);//activer SD
SD.begin(4);//débuté SD
et a l’inverse pour le ethernet:
pinMode(4, OUTPUT);//cs SD
digitalWrite(4,HIGH);// désactiver SD
pinMode(2, INPUT);// activer ethernet
Ethernet.begin(mac);//debut ethrnet
Udp.begin(localPort);
.
.
.
Udp.stop();
voila, donc je ne sais pas ou je merde pourtant c'est bien expliqué sur cette page:
Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). This is on digital pins 11, 12, and 13 on the Duemilanove and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. These pins cannot be used for general i/o. On the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won't work.
Note that because the W5100 and SD card share the SPI bus, only one can be active at a time. If you are using both peripherals in your program, this should be taken care of by the corresponding libraries. If you're not using one of the peripherals in your program, however, you'll need to explicitly deselect it. To do this with the SD card, set pin 4 as an output and write a high to it. For the W5100, set digital pin 10 as a high output.
certe c'est pour le shield ethernet et pas pour le arduino, mais j'ai supposé que c’était pareil et appart pour ethernet ou c'est 2 le 4 pour SD reste le même..
Merci de votre aide ![]()
Skizo !