Arduino library for providing a convenient C++ interface for accessing UAVCAN (v1.0-beta) utilizing libcanard.
This library works for
- ArduinoCore-samd:
Arduino Zero
,MKR 1000
,MKR WiFi 1010
,Nano 33 IoT
,MKR GSM 1400
,MKR NB 1500
,MKR WAN 1300/1310
✔️ - ArduinoCore-mbed:
Portenta H7
,Nano 33 BLE
✔️ - arduino-esp32:
ESP32 Dev Module
,ESP32 Wrover Module
, ... ✔️
- UAVCAN-GNSS-Node: A UAVCAN node with a GNSS sensor providing location data.
- UAVCAN-ToF-Distance-Sensor-Node: Demo firmware for UAVCAN ToF Distance Sensor Node utilizing 107-Arduino-UAVCAN.
#include <ArduinoUAVCAN.h>
/* ... */
ArduinoUAVCAN uavcan(13, transmitCanFrame);
Heartbeat_1_0 hb;
/* ... */
void loop() {
/* Update the heartbeat object */
hb.uptime(millis() / 1000);
hb.mode = Heartbeat_1_0::Mode::OPERATIONAL;
/* Publish the heartbeat once/second */
static unsigned long prev = 0;
unsigned long const now = millis();
if(now - prev > 1000) {
uavcan.publish(hb);
prev = now;
}
/* Transmit all enqeued CAN frames */
while(uavcan.transmitCanFrame()) { }
}
/* ... */
bool transmitCanFrame(CanardFrame const & frame) {
/* ... */
}
Please take a look at the wiki for notes pertaining development of 107-Arduino-UAVCAN
.