Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Human/human.cpp
- Revision:
- 3:dd4678a85a1a
- Parent:
- 1:83459533ff72
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Human/human.cpp Thu May 04 13:56:12 2017 +0000
@@ -0,0 +1,46 @@
+#include "human.h"
+extern N5110 lcd;
+extern Gamepad pad;
+
+
+double human::humanX()
+{
+ while(1) {
+ Vector2D human_x = pad.get_coord();
+ x = (int)(human_x.x*40); //-1 to 1.
+
+ //printf("The value of x(sight) is %i\n",x);
+
+ return x;
+
+
+ }
+}
+
+
+double human::humanY()
+{
+ while(1) {
+ Vector2D human_y = pad.get_coord();
+ y = (int)(-19*human_y.y)-6; //-1 to 1
+
+ //printf("The value of y(sight) is %i\n",y);
+
+ return y;
+ }
+}
+
+
+void human:: print_human()
+{
+ lcd.drawRect(41+x,24+y,3,3,FILL_BLACK); //head
+ lcd.drawLine(41+x+1,24+y+3,41+x+1,24+y+6,1); //body
+ lcd.drawLine(41+x,24+y+4,41+x+2,24+y+4,1);// hands
+ lcd.drawLine(41+x+1,24+y+6,41+x,24+y+7,1);// left leg
+ lcd.drawLine(41+x+1,24+y+6,41+x+2,24+y+7,1);// right leg
+
+ lcd.refresh();
+
+
+
+}
\ No newline at end of file