0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ArduinoAdvent Calendar 2015

Day 25

megasquirtモドキ

Last updated at Posted at 2015-12-24

#概要
業界では、有名なオープンソースのフルコン「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;
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?