farmbot-arduino-firmware/src/CurrentState.cpp

60 lines
849 B
C++

/*
* CurrentState.cpp
*
* Created on: 15 maj 2014
* Author: MattLech
*/
#include "CurrentState.h"
static CurrentState* instance;
static double x = 0.0;
static double y = 0.0;
static double z = 0.0;
CurrentState * CurrentState::getInstance() {
if (!instance) {
instance = new CurrentState();
};
return instance;
};
CurrentState::CurrentState() {
}
double CurrentState::getX() {
return x;
}
double CurrentState::getY() {
return y;
}
double CurrentState::getZ() {
return z;
}
void CurrentState::setX(double newX) {
x = newX;
}
void CurrentState::setY(double newY) {
y = newY;
}
void CurrentState::setZ(double newZ) {
z = newZ;
}
void CurrentState::print() {
Serial.println("Current state");
Serial.print("X:");
Serial.print(x);
Serial.print(", Y:");
Serial.print(y);
Serial.print(", Z:");
Serial.println(z);
}