You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lookbackdemoESP32:I only can read the receiveFrameCount and the sentFrameCount, Can not read and send the data[],why . Can any one give a sample about to sent data and receive data. thanks
#17
Open
giu-wxyao opened this issue
May 23, 2020
· 2 comments
void loop () {
CANMessage frame_rx;
CANMessage frame_tx;
frame_tx.len = 8;
frame_tx.ext = false;
frame_tx.rtr = false;
frame_tx.idx = 0;
frame_tx.id = 0x12;
if (gBlinkLedDate < millis ()) {
gBlinkLedDate += 2000 ;
digitalWrite (LED_BUILTIN, !digitalRead (LED_BUILTIN)) ;
const bool ok = can.tryToSend (frame_tx) ;
if (ok) {
gSentFrameCount += 1 ;
Serial.print ("Sent: ") ;
Serial.println (gSentFrameCount) ;
}else{
Serial.println ("Send failure") ;
}
}
if (can.available ()) {
can.receive (frame_rx) ;
gReceivedFrameCount ++ ;
Serial.print ("Received: ") ;
Serial.println (gReceivedFrameCount) ;
Serial.println (frame.data[0]) ;
Serial.println (frame.data[1]) ;
Serial.println (frame.data[2]) ;
Serial.println (frame.data[3]) ;
Serial.println (frame.data[4]) ;
}
}
The text was updated successfully, but these errors were encountered: