Hi, I am running into problems trying to connect my SD card module. I already have a HC-05 connected and that requires me use pins 50/51, but from all my research I appear to need to use them for the SD module as well. Is there any way to counter-act this, for example different pins to use?
SD Card is a SPI driven device; so, leave it connected with (Vcc ----> 3.3V; CS ----> 4; MOSI ----> 51; SCK ----> 52; MISO -----> 50).
HC05 is UART driven device. MEGA has four hardware UART ports. UART0 has been used for the Serial Monitor. UART1 (TX1, RX1) can safely be used for the HC05.
A: The following is the connection diagram between HC05 and MEGA using UART1 (Tested)
B: Tseting Codes for HC-05. Use Android based Smart Phone as the Master Bluetooth Module
char c = ' ';
void setup()
{
Serial.begin(9600);
Serial.println("Arduino is ready");
// HC-05 default serial speed for communication mode is 9600
Serial1.begin(9600);
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (Serial1.available())
{
c = Serial1.read();
Serial.write(c);
}
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
{
c = Serial.read();
// Copy the serial data back to to the serial monitor.
// This makes it easy to follow the commands and replies
Serial.write(c);
Serial1.write(c); //send to Bluetooth Master (Smart Phone) via UART1
}
}
C: Operating Procedures (1) Build circuit as per diagram of Section-A.
(2) Compile and upload the sketch of Section-B. Bring in the Serial Monitor.
(c) Collect an Android based Smart Phone with a Bluetooth Terminal App installed. This is the Master Bluetooth Terminal and connect/pair it with the the Slave Bluetooth Terminal which is attached with MEGA.
(d) Send the character A from the Master; check that the character has appeared on the screens of both the Master and the Serial Monitor.
(e) Send the character R from the Serial Monitor; check that the character has papered on the screen of the Master.
This is probably the dumbest thread I have ever seen, but I deleted comment to that effect because I believe there might be an HC-05 available on a shield which can indeed run on SPI, and that may be what Crossroads was alluding to. It is probably a switchable option anyway, and only for use by the desperate. Don't ask why you would do that on a Mega....
This is probably the dumbest thread I have ever seen,
When a man speaks from his experience, probably he is talking in the most authentic way as it will produce straight useful result in contrast to telling 'then move those signals someplace else' -- where?. In the shop and in the net, I have not yet seen any SD that goes other than SPI and also any HC05 that goes other than UART.