Joseph Boettcher / Mbed 2 deprecated uLCD_Robot_2

Dependencies:   4DGL-uLCD-SE PinDetect mbed

Fork of my2036lab2robotLCD by jim hamblen

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Robot.h Source File

Robot.h

00001 #include <iostream>
00002 using namespace std;
00003 
00004 class Robot
00005 {
00006 public:
00007     void draw() {
00008         uLCD.filled_circle(xPosition, yPosition, 2, BLUE);
00009         uLCD.filled_circle(xPosition - 8, yPosition - 8, 4, GREEN);    
00010         uLCD.filled_circle(xPosition + 8, yPosition - 8, 4, GREEN);    
00011         uLCD.filled_rectangle(xPosition - 5, yPosition + 10, xPosition + 5, yPosition + 5 , BLACK); 
00012         uLCD.circle(xPosition, yPosition, 18, BLACK);    }
00013     void erase() {
00014         uLCD.filled_rectangle(0, 126, 126, 26, RED);    }
00015     void moveForward(int distance) {
00016         yPosition++;    }
00017     void moveBackward(int distance) {
00018         yPosition--;    }
00019     void moveLeft(int distance) {
00020         xPosition--;    }
00021     void moveRight(int distance) {
00022         xPosition++;    }
00023     Robot() {
00024         xPosition = 63;
00025         yPosition = 63;
00026     }
00027 private:
00028     int xPosition;
00029     int yPosition;
00030 };