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
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 };
Generated on Fri Jul 29 2022 00:55:37 by
1.7.2
