2
2

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.

arduinoでインスツルメント クラスター

Last updated at Posted at 2016-02-08

#概要
arduino unoでcanからインスツルメント クラスターを操作した。
#写真
MVC-013S.JPG
#動画
https://www.youtube.com/watch?v=tfVAaIHo0NA
#回路図
can1.JPG
#サンプルコード

#include <SPI.h>
#include "mcp_can.h"

const int SPI_CS_PIN = 10;
MCP_CAN CAN(SPI_CS_PIN);
unsigned char stmp[8] = {
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0
};
void setup()
{
	Serial.begin(115200);
START_INIT:
	if (CAN_OK == CAN.begin(CAN_500KBPS))
	{
		Serial.println("CAN BUS Shield init ok!");
	}
	else
	{
		Serial.println("CAN BUS Shield init fail");
		Serial.println("Init CAN BUS Shield again");
		delay(100);
		goto START_INIT;
	}
}
void loop()
{
	unsigned int i = 0;
	unsigned int j = 0;
	for (i = 0; i < 129; i++)
	{
		stmp[0] = i;
		stmp[4] = i;
		for (j = 0; j < 10; j++)
		{
			CAN.sendMsgBuf(0x201, 0, 8, stmp);
			delay(100);
		}
	}
}

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?