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: 4DGL-uLCD-SE PinDetect mbed
Fork of my2036lab2robotLCD by
Revision 1:5a1311f0ea06, committed 2016-11-06
- Comitter:
- jboettcher
- Date:
- Sun Nov 06 22:25:24 2016 +0000
- Parent:
- 0:343fbeea672c
- Commit message:
- complete;
Changed in this revision
| Robot.h | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Robot.h Fri Jan 23 13:47:32 2015 +0000
+++ b/Robot.h Sun Nov 06 22:25:24 2016 +0000
@@ -1,28 +1,30 @@
+#include <iostream>
+using namespace std;
+
class Robot
{
public:
void draw() {
-//needs code here
- }
+ uLCD.filled_circle(xPosition, yPosition, 2, BLUE);
+ uLCD.filled_circle(xPosition - 8, yPosition - 8, 4, GREEN);
+ uLCD.filled_circle(xPosition + 8, yPosition - 8, 4, GREEN);
+ uLCD.filled_rectangle(xPosition - 5, yPosition + 10, xPosition + 5, yPosition + 5 , BLACK);
+ uLCD.circle(xPosition, yPosition, 18, BLACK); }
void erase() {
-//needs code here
- }
+ uLCD.filled_rectangle(0, 126, 126, 26, RED); }
void moveForward(int distance) {
-//needs code here
- }
+ yPosition++; }
void moveBackward(int distance) {
-//needs code here
- }
+ yPosition--; }
void moveLeft(int distance) {
-//needs code here
- }
+ xPosition--; }
void moveRight(int distance) {
-//needs code here
- }
-//needs code to init x,y
+ xPosition++; }
Robot() {
+ xPosition = 63;
+ yPosition = 63;
}
private:
int xPosition;
int yPosition;
-};
+};
\ No newline at end of file
--- a/main.cpp Fri Jan 23 13:47:32 2015 +0000
+++ b/main.cpp Sun Nov 06 22:25:24 2016 +0000
@@ -57,7 +57,7 @@
// main program
int main()
{
- uLCD.printf("\nmyRobot!\nyourname");
+ uLCD.printf("\nmyRobot!\nJoseph Boettcher");
//setup four SPST push buttons
pb1.mode(PullUp); //add internal pullup resistor
pb2.mode(PullUp);
@@ -123,7 +123,7 @@
break;
//no pb or multiple pbs hit
default :
-// myLed1 = 0;
+ // myLed1 = 0;
myLed2 = 0;
myLed3 = 0;
myLed4 = 0;
