Help us understand the problem. What is going on with this article?

megasquirtモドキ

More than 5 years have passed since last update.

概要

業界では、有名なオープンソースのフルコン「MEGASQUIRT」のフェイクです。
見た目、フルコンをセッティングしているように、見えます。
OBD2のライブデータを表示しています。
arduino unoとelm327を使ってます。
tunnerstudioからは、megasquirtに見えます。

写真

20151117211011273.jpg
20151117211004883.jpg

ムービー

https://www.youtube.com/watch?v=1HTn73HCVV8

回路図

elm.JPG

サンプルコード

#include <SoftwareSerial.h>
#include <Obdsquirt.h>

Obdsquirt squirt;
int n = 0;
void setup()
{
    pinMode(13, OUTPUT);
    squirt.begin();
    while (!squirt.init());
}
void loop()
{
    int value;
    digitalWrite(13, HIGH);
    if (Serial.available())
    {
        squirt.command();
    }
    if (squirt.isLoop())
    {
        switch (n)
        {
        case 0:
            if (squirt.read(PID_RPM, value))
            {
                squirt.currentStatus.RPM = value;
            }
        break;
        case 1:
            if (squirt.read(PID_THROTTLE, value))
            {
                squirt.currentStatus.TPS = value;
            }
        break;
        case 2:
            if (squirt.read(PID_COOLANT_TEMP, value))
            {
                squirt.currentStatus.coolant = value + 40;
            }
        break;
        case 3:
            if (squirt.read(PID_INTAKE_TEMP, value))
            {
                squirt.currentStatus.IAT = value + 40;
            }
        break;
        case 4:
            if (squirt.read(PID_INTAKE_MAP, value))
            {
                squirt.currentStatus.MAP = value;
            }
        break;
        default:
        break;
        }
    }
    n++;
    if (n > 4) n = 0;
}

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away