Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f1acffe

Browse files
committedNov 3, 2023
Update CANReadFilter.ino
Updated Description
1 parent 62ac782 commit f1acffe

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed
 

‎libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino

+15-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
CANRead
33
44
Receive and read CAN Bus messages
5+
Read ID 0x100 EXTENDED and ID 0x10 STANDARD
56
67
78
Mailbox Groups 0-3 (Mailbox 0-15) -> TRANSMIT
89
Mailbox Groups 4-5 (Mailbox 16-23) -> RECEIVE EXTENDED
910
Mailbox Groups 6-7 (Mailbox 24-31) -> RECEIVE STANDARD
1011
12+
Mailbox Mask 5,7 are preset with 0x1FFFFFFF
13+
Mailbox Mask 4,6 are preset with 0x00
14+
15+
1116
See the full documentation here:
1217
https://docs.arduino.cc/tutorials/uno-r4-wifi/can
1318
*/
@@ -18,6 +23,9 @@
1823

1924
#include <Arduino_CAN.h>
2025

26+
#define Mask11Bit 0x1FFC0000
27+
#define Mask29Bit 0x1FFFFFFF
28+
2129
/**************************************************************************************
2230
* SETUP/LOOP
2331
**************************************************************************************/
@@ -27,10 +35,14 @@ void setup()
2735
Serial.begin(115200);
2836
while (!Serial) { }
2937

30-
CAN.setMailboxMask(4, 0x1FFFFFFF);
31-
CAN.setMailboxMask(6, 0x1FFFFFFF);
38+
CAN.setMailboxMask(4, Mask29Bit);
39+
CAN.setMailboxMask(6, Mask11Bit);
40+
41+
for (int c=16; c <= 23; c++) {
42+
CAN.setMailboxID(c, 0x0100);
43+
}
3244

33-
for (int c=16; c <= 31; c++) {
45+
for (int c=24; c <= 31; c++) {
3446
CAN.setMailboxID(c, 0x10);
3547
}
3648

0 commit comments

Comments
 (0)
Please sign in to comment.