- Wed Jan 15, 2014 3:10 am
#5531
hi stanley
i wrote this code but i doesn't work… and its only blink the led… after i want to print the speed in kph in some java program… i will very grateful if you can help me.. thanks
(the rpm pid works fine).
#include <Arduino.h>
#include <OBD.h>
#include <Wire.h>
COBD obd;
void setup()
{
pinMode(13, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
obd.begin();
while (!obd.init());
}
void loop()
{
int value;
int vel;
if (obd.read(PID_SPEED, kph)){
digitalWrite(13, vel = 0 ? HIGH : LOW);
digitalWrite(A0, vel >= 100 ? HIGH : LOW);
}
if (obd.read(PID_RPM, value)) {
digitalWrite(A1, value > 900 ? HIGH : LOW);
}
}
i wrote this code but i doesn't work… and its only blink the led… after i want to print the speed in kph in some java program… i will very grateful if you can help me.. thanks
(the rpm pid works fine).
#include <Arduino.h>
#include <OBD.h>
#include <Wire.h>
COBD obd;
void setup()
{
pinMode(13, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
obd.begin();
while (!obd.init());
}
void loop()
{
int value;
int vel;
if (obd.read(PID_SPEED, kph)){
digitalWrite(13, vel = 0 ? HIGH : LOW);
digitalWrite(A0, vel >= 100 ? HIGH : LOW);
}
if (obd.read(PID_RPM, value)) {
digitalWrite(A1, value > 900 ? HIGH : LOW);
}
}