Pages: [1]   Go Down
Author Topic: Two Serial.begin  (Read 398 times)
0 Members and 1 Guest are viewing this topic.
Poland/Wroclaw
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Is this setup function is correct?
Code:
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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Poland/Wroclaw
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12577
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Poland/Wroclaw
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does one Serial.begin() will handle obd communication and sd card reader?
Writing to the SD card doesn't involve Serial at all.
Logged

Pages: [1]   Go Up
Jump to: