Pages: 1 2 3 [4]   Go Down
Author Topic: Bike interface OBD  (Read 13223 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think i need to explain the problem.
If i use this code:
Code:
void setup() {
  Serial.begin(9600);    
  Serial1.begin(9600);
}
void loop() {
  if (Serial1.available()) {
    Serial.println(Serial1.read());
  }
}
i get:
Code:
103
217
123
229
103
217
123
229
103
217
123
229
103
217
123
235
103
217
123
0
103
217
123
0
103
217
123
235
103
217

But if i connect the wideband directly to the pc and printing values using Putty i get this:
Code:
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8
14.8

If i do:
Code:
void setup() {
  Serial.begin(9600);   
  Serial1.begin(9600);
}
void loop() {
  if (Serial1.available()) {
    Serial.write(Serial1.read());
  }
}


i recieve this:
Code:
{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{åëgÙ{

Why putty shows me the right value but arduino does not??? Its just a serial connection... Is there a option for Serial read that can do that?
« Last Edit: June 11, 2014, 02:59:41 pm by o5i_ » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13739
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

void setup()
{
  Serial.begin(9600);    
  Serial1.begin(9600);
}
void loop()
{
  if (Serial1.available())
  {
    Serial.print(Serial1.read(), DEC); //  print as decimal might help
  }
}
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, i tried, but its just the same...
I think something in reading function is wrong because if i do serial read  to serial write it should be the same as it shows if i connect it directly but it isnt.....
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13739
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the reading function returns an int  (2 bytes) and the write() wants a byte as param
That is why I proposed to use print () iso write() as print() can print int's
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

dont know whats wrong... is it some ascii thing?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, im back from Holidays...
I added the cardslot to the board and tried if the sketch work but it didnt work, dont know why... If i try the sd example it works verry well and it is just the same... If i put everything in setup section it works but if i do the writing section to the loop it doesnt work...
I tested the circuit whit the z-diode but it is not the best choice, i think an opto-coupler work better...
http://fish.x64.me/doc/sdslogger01.ino
« Last Edit: June 28, 2014, 12:40:59 pm by o5i_ » Logged

Pages: 1 2 3 [4]   Go Up
Jump to: