R1370 library only get gyro
Dependents: quadOmni_yanagi R1370 gyro_test wheel_test3 wheel_test3 ... more
Fork of R1307 by
R1370.cpp
- Committer:
- tknara
- Date:
- 2017-09-04
- Revision:
- 4:96f91d9e3bff
- Parent:
- 2:30d8a4f08cbd
File content as of revision 4:96f91d9e3bff:
#include "R1370.h" R1370::R1370(PinName Tx,PinName Rx):serial(Tx,Rx) { R1370::serial.baud(115200); } int R1370::update() { int i; if((data[0]=serial.getc())==0xAA){ for(i = 1;i < 15;i++) { data[i] = serial.getc(); } angle = ((data[3]&0xFF)|((data[4]<<8)&0xFF00)); gyro = angle/100.0; return 0; }else{ return 1; } } float R1370::getAngle() { return gyro; }