mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
47 lines
860 B
C++
47 lines
860 B
C++
//
|
|
// 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);
|
|
|
|
// ESP32
|
|
// as5600.begin(14,15);
|
|
// AVR
|
|
as5600.begin(4); // set direction pin.
|
|
as5600.setDirection(AS5600_CLOCK_WISE); // default, just be explicit.
|
|
int b = as5600.isConnected();
|
|
Serial.print("Connect: ");
|
|
Serial.println(b);
|
|
delay(1000);
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
// Serial.print(millis());
|
|
// Serial.print("\t");
|
|
Serial.print(as5600.readAngle());
|
|
Serial.print("\t");
|
|
Serial.println(as5600.rawAngle());
|
|
// Serial.println(as5600.rawAngle() * AS5600_RAW_TO_DEGREES);
|
|
|
|
delay(1000);
|
|
}
|
|
|
|
|
|
// -- END OF FILE --
|