-1

I have an ESP32 module connected to my computer. I am using Thonny IDE to program my ESP32 device using micropython code. I am trying to send data over CAN bus but I m getting error.

code:

from machine import CAN

can = CAN(mode=CAN.NORMAL, baudrate=500000, pins=('P22', 'P23'))
can.send(id=12, data=bytes([1, 2, 3, 4, 5, 6, 7, 8]))
can.recv()

error:

ImportError: can't import name CAN
Alok Mishra
  • 694
  • 5
  • 20

1 Answers1

1

At the time of writing this answer, according to this GitHub issue, the CAN API doesn't seem to be supported on the ESP32 build of MicroPython.

There is a pull request for an implementation, but is currently not working.

gre_gor
  • 6,669
  • 9
  • 47
  • 52