How to send CAN message from Arduino setup function

Hi,

I would like to send out a CAN message every time the CBT boots up. So I wrote a function in my middleware class and would like to call it from the Arduino setup function. However I am not able to call that function...
How should I call my function from the setup routine or how should I send out a message when the CBT boots up?

Thanks,

Reto

administrators

Hey Reto!

The best way to do it would be in the tick() method of your middleware class. You can add a class property with the type of boolean to do a check in subsequent tick() calls to decide if you want to perform the action (sending a message) again.

Here is an example of how to do this in the Mazda code. It does a gauge sweep then the CBT starts up.
https://github.com/CANBus-Triple/CANBus-Triple/blob/master/avr/examples/CANBusTriple_Mazda/MazdaLED.h#L85

Also, in that example you will see an easy way to create a new Msg instance and push it to the dispatch stack for sending!

:)

Looks like your connection to CANBus Triple was lost, please wait while we try to reconnect.