Hi,
I am working on a project where I need to send a command message to Eaton's smart fuse box mVEC from my Arduino+MCP2515 board. Using this command, I want to turn relay 1 on and leave the rest relays unchanged. I need your help with developing code for this task.
According to the product specification of this Eaton fusebox mVEC, I need to send a message called 0X80 to command the fuse box to turn on/off the relays. While declaring the msg in my program, should I declare it as 0X80 or its parameter group number ? What should be data length 6 bytes or 8 bytes ?
#include <SPI.h>
#include "mcp2515.h"
struct can_frame canMsg1;
struct can_frame canMsg2;
MCP2515 mcp2515(10);
int i;
void setup()
{
while (!Serial);
Serial.begin(115200);
SPI.begin();
mcp2515.reset();
mcp2515.setBitrate(CAN_125KBPS);
mcp2515.setNormalMode();
Serial.println("Example: Write to CAN");
canMsg1.can_id = 0x80;
canMsg1.can_dlc = 6;
}
void loop()
{
canMsg1.data[0] = 0x80;
canMsg1.data[1] = 0x00;
canMsg1.data[2] = 0xFD; //Turn on Relay 1 and leave relays 2,3,4 unchanged
canMsg1.data[3] = 0xFF;
canMsg1.data[4] = 0xFF;
canMsg1.data[5] = 0xFF;
mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
Serial.println("Messages sent");
}