Hi @runger , @Karl_Makes_Music, @Owen_Williams, @Valentine, @Antun_Skuric
So I know got the ESP32 connected and it works in open loop. I Can make the GM3506 motor spin around and also set an angle.
I am still struggling with the SPI when trying to get the AS5048A to work
I tried the simple code for getting the SPI to work, but the monitor just freaks out like this:
I dont know if it something with the connections on the AS5048?
I saw on a post that there has been som confusion about the wiring from it?
This is the post:
I connected
CC to SS pin 5
MISO to pin 23
CLK to pin 18
Also I supplied the AS5048A with 5V and GND
Here is the code:
#include <SimpleFOC.h>
* 1. List item
// MagneticSensorSPI(int cs, float _cpr, int _angle_register)
// cs - SPI chip select pin
// bit_resolution - sensor resolution
// angle_register - (optional) angle read register - default 0x3FFF
MagneticSensorSPI AS5048 = MagneticSensorSPI(5, 14, 0x3FFF);
void setup() {
// monitoring port
Serial.begin(9600);
// initialise magnetic sensor hardware
AS5048.init();
Serial.println("AS5048 ready");
_delay(1000);
}
void loop() {
// IMPORTANT - call as frequently as possible
// update the sensor values
AS5048.update();
// display the angle and the angular velocity to the terminal
Serial.print(AS5048.getAngle());
Serial.print("\t");
Serial.println(AS5048.getVelocity());
}