A multifunctional and modular Firmware for Multitech's mDot based on ARM mBed provides a widerange of functionality for several Sensors such as MAX44009, BME280, MPU9250, SI1143 and uBlox. It allows you to quickly build a Sensornode that measures specific data with its sensors and sends it via LoRaWAN.

Dependencies:   mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MPU9250GyroscopeMessage.cpp Source File

MPU9250GyroscopeMessage.cpp

00001 /*
00002  * MPU9250GyroscopeMessage.cpp
00003  *
00004  *  Created on: Jun 1, 2016
00005  *      Author: Adrian
00006  */
00007 
00008 #include "MPU9250GyroscopeMessage.h "
00009 #include "main.h"
00010 
00011 MPU9250GyroscopeMessage::MPU9250GyroscopeMessage() {
00012     loraMessageId.push_back(MPU9250_X_GYROSCOPE_MESSAGE_ID);
00013     loraMessageId.push_back(MPU9250_Y_GYROSCOPE_MESSAGE_ID);
00014     loraMessageId.push_back(MPU9250_Z_GYROSCOPE_MESSAGE_ID);
00015 }
00016 
00017 MPU9250GyroscopeMessage::~MPU9250GyroscopeMessage() {
00018     // TODO Auto-generated destructor stub
00019 }
00020 
00021 void MPU9250GyroscopeMessage::setXGyro(float xGyro){
00022     this->xGyro = xGyro;
00023 }
00024 
00025 void MPU9250GyroscopeMessage::setYGyro(float yGyro){
00026     this->yGyro = yGyro;
00027 }
00028 
00029 void MPU9250GyroscopeMessage::setZGyro(float zGyro){
00030     this->zGyro = zGyro;
00031 }
00032 
00033 float MPU9250GyroscopeMessage::getXGyro(){
00034     return xGyro;
00035 }
00036 
00037 float MPU9250GyroscopeMessage::getYGyro(){
00038     return yGyro;
00039 }
00040 
00041 float MPU9250GyroscopeMessage::getZGyro(){
00042     return zGyro;
00043 }
00044 
00045 char* MPU9250GyroscopeMessage::getLoRaMessageString(){
00046     loraMessage.clear();
00047     char buffer[20];
00048     sprintf(buffer,"%s:%.2f,",loraMessageId.at(0).c_str(),getXGyro());
00049     loraMessage.append(buffer);
00050     sprintf(buffer,"%s:%.2f,",loraMessageId.at(1).c_str(),getYGyro());
00051     loraMessage.append(buffer);
00052     sprintf(buffer,"%s:%.2f,",loraMessageId.at(2).c_str(),getZGyro());
00053     loraMessage.append(buffer);
00054     return (char*) loraMessage.c_str();
00055 }
00056 
00057 
00058