Go Down

Topic: Two Serial.begin (Read 486 times) previous topic - next topic

marcin_i

Hi,
Is this setup function is correct?
Code: [Select]
void setup() {
  Serial.begin(OBD_SERIAL_BAUDRATE);
  Serial.begin(9600);
  // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
  // breadboards.  use SPI_FULL_SPEED for better performance.
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
  // append a line to the logfile
}


I can't figure out why it's still doesn't work.

PaulS

Quote
Is this setup function is correct?

The second Serial.begin() value will overwrite the first one. You might as well delete the first one.

Quote
I can't figure out why it's still doesn't work.

What doesn't work? How doesn't it work?

marcin_i

Hi,
Thank you for quick reply.
I want to log all data from OBD2 in my car. When I connect arduino to OBD2 nothing happends. There is no changes in log file on SD card. Does one Serial.begin() will handle obd communication and sd card reader?

PeterH

Divide the problem up. Are you capable of creating and writing to a log file on the SD card? You should be certain that this part works before you try to add in the OBD functionality.
I only provide help via the forum - please do not contact me for private consultancy.

marcin_i

Yes I'm able to write to file on sd card. Now I wonder - I must check - if OBD and SD card will be cooperate on one boundrate which is quite high (38400). First tests are optimistic.
Thank you for help and suggestions.

PaulS

Quote
Does one Serial.begin() will handle obd communication and sd card reader?

Writing to the SD card doesn't involve Serial at all.

Go Up