GY-63_MS5611/libraries/AS5600/examples/AS5600_demo/AS5600_demo.ino

47 lines
860 B
Arduino
Raw Normal View History

2022-05-29 16:07:48 -04:00
//
// FILE: AS5600_demo.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// DATE: 2022-05-28
#include "AS5600.h"
#include "Wire.h"
AS5600 as5600; // use default Wire
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("AS5600_LIB_VERSION: ");
Serial.println(AS5600_LIB_VERSION);
2022-12-21 15:44:41 -05:00
// ESP32
// as5600.begin(14,15);
// AVR
2022-05-29 16:07:48 -04:00
as5600.begin(4); // set direction pin.
as5600.setDirection(AS5600_CLOCK_WISE); // default, just be explicit.
2022-09-01 05:31:32 -04:00
int b = as5600.isConnected();
Serial.print("Connect: ");
Serial.println(b);
2022-12-21 15:44:41 -05:00
delay(1000);
2022-05-29 16:07:48 -04:00
}
void loop()
{
2022-09-01 05:31:32 -04:00
// Serial.print(millis());
// Serial.print("\t");
2022-05-29 16:07:48 -04:00
Serial.print(as5600.readAngle());
Serial.print("\t");
2022-12-21 15:44:41 -05:00
Serial.println(as5600.rawAngle());
// Serial.println(as5600.rawAngle() * AS5600_RAW_TO_DEGREES);
2022-05-29 16:07:48 -04:00
delay(1000);
}
// -- END OF FILE --