aboutsummaryrefslogtreecommitdiff
path: root/libraries/Robot_Control/helper.cpp
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-06-01 23:16:02 +0200
committerCristian Maglie <c.maglie@bug.st>2013-06-01 23:16:02 +0200
commit177ad96f866714a4962be57f69cd3d5a6334cde1 (patch)
tree1072239986340d6a239adac924eddf2e1d1ca566 /libraries/Robot_Control/helper.cpp
parent6cff36ac5e85c74bcb45cc53491ad69d64520b36 (diff)
parentd90fcca5839d13d57ed527d4009b78d22dafbde7 (diff)
Merge branch 'merge-1.0.5' into ide-1.5.x-discovery
Diffstat (limited to 'libraries/Robot_Control/helper.cpp')
-rw-r--r--libraries/Robot_Control/helper.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/libraries/Robot_Control/helper.cpp b/libraries/Robot_Control/helper.cpp
new file mode 100644
index 0000000..a7a956a
--- /dev/null
+++ b/libraries/Robot_Control/helper.cpp
@@ -0,0 +1,45 @@
+#include "ArduinoRobot.h"
+
+void RobotControl::drawBase(){
+ Arduino_LCD::drawCircle(64,80,50,foreGround);
+ Arduino_LCD::drawLine(64,30,64,20,foreGround);
+}
+void RobotControl::drawDire(int16_t dire){
+ static uint8_t x_old;
+ static uint8_t y_old;
+ static uint8_t x_t_old;
+ static uint8_t y_t_old;
+
+ uint8_t x=60*sin(dire/360.0*6.28)+64;
+ uint8_t x_t=40*sin(dire/360.0*6.28)+64;
+ uint8_t y=60*cos(dire/360.0*6.28)+80;
+ uint8_t y_t=40*cos(dire/360.0*6.28)+80;
+
+ Arduino_LCD::drawLine(x_t_old,y_t_old,x_old,y_old,backGround);
+ Arduino_LCD::drawLine(x_t,y_t,x,y,RED);
+
+ x_old=x;
+ y_old=y;
+ x_t_old=x_t;
+ y_t_old=y_t;
+}
+
+void RobotControl::drawCompass(uint16_t value){
+ drawBase();
+ drawDire(value);
+ debugPrint(value,57,76);
+}
+
+//display logos
+void RobotControl::displayLogos(){
+ _drawBMP("lg0.bmp",0,0);
+ delay(2000);
+ _drawBMP("lg1.bmp",0,0);
+ delay(2000);
+ clearScreen();
+}
+
+//wait for a button to be pressed
+void RobotControl::waitContinue(uint8_t key){
+ while(!(Robot.keyboardRead()==key));
+}