Hi Guys hope someone can shed some light on this subject.
I have a UNO that i want to connect to a Data radio and SD card
problem is both the SD card and data Radio works on SPI bus. I know you can use two devices on the smae SPI bus but im not fimilar with the Shift out functions. i wantted to you if it was possible if i created my own clown of the SPI.h file and changed the pin outs to lets say. 7,8,9 and inlcuded into my program under name
#include SPI2.h
will that work ? seems alot easier then trying to figure out master and slaves on the same line.
I know you can use two devices on the smae SPI bus but im not fimilar with the Shift out functions.
This is like saying "I know that you can use two devices on the same bus, but I don't like chocolate pudding". The two phrases have absolutely nothing in common.
i wantted to you if it was possible if i created my own clown of the SPI.h file and changed the pin outs to lets say. 7,8,9 and inlcuded into my program under name
#include SPI2.h
Sure, you could do that. Wouldn't work. SPI is hardware based. It is a hardware function of pins 11, 12 and 13. You can't create a header file to rewire the internals of the chip. Well, not and have it actually work, anyway.
seems alot easier then trying to figure out master and slaves on the same line.
I don't see how setting the appropriate slave select pins HIGH and LOW is that difficult. Create a function, useRadio() to set the two slave select pins one way, and create a function, useCard() to set them the other way.
Hi Nick wasnt planning on rewriting the new library only copy and past and change pin layouts in that library . I have been reading up on how to use two devices now on one bus , and I agree its straight forward . im just a bit sceptically of how to make it work , my two SPI devices is a SD card and a Data radio that has to send information from the SD card which means I need to talk to both at the same time ...? or am i mistaken
Yes thank you for you comment , I didnt know SPI was hardware based only thought might work as softwareSerial library.
I assume the best way forward is to setup the functions like you called them. then Read from the SD card save to buffer switch to Radio program and read from buffer to transmit yes?