Arduino UNO R4 looks like the old (and slow) Arduino Uno board, but its equipped with the Renesas Cortex M4 MCU, 32KB sram, and 256KB flash, ESP32 wifi and a fancy led matrix
It has a I2C serial on the pinout - SDA / SCL on pin D18 ad D19, ideal to connect the Magneto meter from STMicro
IIS2MDC magneto sensorLucky to ahve the STM MEms sensor eval kit for industrial sensors, I used the STEVAL-MKI185V1 board. Soldered some pins and connected it according the app-note (don' t forget the SDA/SCL pull up resistors :) and the CS connected to Vdd.
All STM eval boards have Arduino libraries which are derived from the STM libraries, and for simple purposes a bit overdone, so the code written has simple I2C read and write of the right registers.
CodeArduino sketch is using the Arduino libraries for the Led Matrix and I2C
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
#include <Wire.h>
#include "Debug.h"
#include "Config.h"
#include <Math.h> The Debug.h isa simple Serial Print debug handler (can be turned off) and Config.h has the sensor struct and global variable defined, no rocket science.
App is setting up all peripherals, then read the sensor, calculate the heading and direction and print it on the Led Matrix.
BugThere is a ' preprogrammed' bug in the Arduino_LED_Matrix.h library.The function endDraw() seems to clear row0 of the led matrix, which is not that great if you use any of the graph functions :
// display the drawing
void endDraw() {
ArduinoGraphics::endDraw();
// clear first line (no idea why it gets filled with random bits, probably some math not working fine for super small displays)
for (int i = 0; i < canvasWidth; i++) {
_canvasBuffer[0][i] = 0; // <-- REMOVE> this is causing point(x,y) to fail on row 0
}
renderBitmap(_canvasBuffer, canvasHeight, canvasWidth);
}










Comments