Teensy dev board & 6-Axis Accelerometer
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
Hi Every one,
I am trying to use Serial 6-Axis Accelerometer (https://www.dfrobot.com/product-2200.html) using Teensy 4.1 development board (https://www.pjrc.com/teensy/).
Unfortunately I could not get it to work.
Here is the code I am using.
#include <DFRobot_WT61PC.h>
#include <SoftwareSerial.h>
//Use software serial port RX:10,TX:11
SoftwareSerial mySerial(10, 11);
DFRobot_WT61PC sensor(&mySerial);
void setup()
{
//Use Serial as debugging serial port
Serial.begin(115200);
//Use software serial port mySerial as communication seiral port
mySerial.begin(9600);
//Revise the data output frequncy of sensor FREQUENCY_0_1HZ for 0.1Hz, FREQUENCY_0_5HZ for 0.5Hz, FREQUENCY_1HZ for 1Hz, FREQUENCY_2HZ for 2Hz,
// FREQUENCY_5HZ for 5Hz, FREQUENCY_10HZ for 10Hz, FREQUENCY_20HZ for 20Hz, FREQUENCY_50HZ for 50Hz,
// FREQUENCY_100HZ for 100Hz, FREQUENCY_125HZ for 125Hz, FREQUENCY_200HZ for 200Hz.
sensor.modifyFrequency(FREQUENCY_10HZ);
}
void loop()
{
if (sensor.available()) {
Serial.print("Acc\t"); Serial.print(sensor.Acc.X); Serial.print("\t"); Serial.print(sensor.Acc.Y); Serial.print("\t"); Serial.println(sensor.Acc.Z); //acceleration information of X,Y,Z
Serial.print("Gyro\t"); Serial.print(sensor.Gyro.X); Serial.print("\t"); Serial.print(sensor.Gyro.Y); Serial.print("\t"); Serial.println(sensor.Gyro.Z); //angular velocity information of X,Y,Z
Serial.print("Angle\t"); Serial.print(sensor.Angle.X); Serial.print("\t"); Serial.print(sensor.Angle.Y); Serial.print("\t"); Serial.println(sensor.Angle.Z); //angle information of X, Y, Z
Serial.println(" ");
}
}
I am really appreciate if you can highlight where I go wrong.
Thanks for you support.
Hi
Sorry, this module hasn't tested for compatibility with Teensy 4.1 development board. It may not support this development board.
From my point of view, i guess the soft serial on Teensy may be different from Arduino, you can try to adjust that part of the code.
Hope it can help!
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)