halerror.py 240 B

123456789101112131415
  1. # test hal errors
  2. import pyb
  3. i2c = pyb.I2C(2, pyb.I2C.MASTER)
  4. try:
  5. i2c.recv(1, 1)
  6. except OSError as e:
  7. print(repr(e))
  8. can = pyb.CAN(1, pyb.CAN.NORMAL)
  9. try:
  10. can.send('1', 1, timeout=50)
  11. except OSError as e:
  12. print(repr(e))