CANChannel verify error?

Trying to get started with CANbus using the Web IDE … but the first line won’t verify even though I copied it straight from the docs. When I try:
CANChannel can(CAN_D1_D2);
I get:
error: ‘CAN_D1_D2’ was not declared in this scope
What am I doing wrong??

I get that error if I target the Core (0.4.9), which does not appear to support CAN. It’s not on the Core data sheet or documentation.

It compiles properly for the Photon (0.4.9).

It does not compile with the Electron (0.4.8) since CAN support was added in 0.4.9. But the hardware should support it, so it should work in 0.5.0 or the develop version, though I didn’t check it.

1 Like

Thanks! That clued me in to my problem: I have 2 photons in my Devices list, but neither was ‘selected’. I was coding before selecting the hardware. Apparently the build target defaults to a Core in that case, which is why your response is correct. Thanks again for the help!

1 Like