I firstly started from this structure
And I used SoftwareSerial function and the followings are the code used.
/ RECV EXAMPLE OF SERIAL CAN MODULE
// unsigned char recv(unsigned long *id, uchar *buf);
// SUPPORT: [email protected]
#include <Serial_CAN_Module.h>
#include <SoftwareSerial.h>
Serial_CAN can;
static const int RXPin = 7, TXPin = 6;
static const uint32_t GPSBaud = 9600;
void setup()
{
Serial.begin(9600);
delay(1000);
can.begin(TXPin, RXPin, GPSBaud); // tx, rx
Serial.println("begin");
//can.canRate(CAN_RATE_500);
}
unsigned long id = 0;
unsigned char dta[8];
// send(unsigned long id, byte ext, byte rtrBit, byte len, const byte *buf);
void loop()
{
delay(100);
static int index = 0;
index++;
if(index > 255) index = 0;
char Str[100];
sprintf(Str, " index = %d \n", index);
Serial.println(Str);
if(can.recv(&id, dta))
{
Serial.print("GET DATA FROM ID: ");
Serial.println(id);
for(int i=0; i<8; i++)
{
Serial.print("0x");
Serial.print(dta[i], HEX);
Serial.print('\t');
}
Serial.println();
}
else
{
Serial.println(" no data ");
}
delay(100);
}
// END FILE
It runs like the following figure;
What I want to make is the wio terminal version of this CAN communication system.
like the followings figure
And I changed the one line like the followings;
static const int RXPin = 1, TXPin = 0;
it doesn’t work at all like the followings ;
Maybe in order to use D0 and D1 and Softwareserial , there must be something more to do for me.
Please let me know about that.
Thanks.