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
Robot.h
00001 #include <iostream> 00002 using namespace std; 00003 00004 class Robot 00005 { 00006 public: 00007 void draw() { 00008 uLCD.circle(xPosition - 8, yPosition - 8, radius, BLACK); 00009 uLCD.circle(xPosition + 8, yPosition - 8, radius, BLACK); 00010 uLCD.filled_circle(xPosition - 8, yPosition - 8, 2, BLACK); 00011 uLCD.filled_circle(xPosition + 8, yPosition - 8, 2, BLACK); } 00012 void erase() { 00013 uLCD.filled_rectangle(0, 126, 126, 26, RED); } 00014 void moveForward(int distance) { 00015 radius++; } 00016 void moveBackward(int distance) { 00017 radius--; } 00018 void moveLeft(int distance) { 00019 xPosition--; } 00020 void moveRight(int distance) { 00021 xPosition++; } 00022 Robot() { 00023 radius = 5; 00024 xPosition = 63; 00025 yPosition = 63; 00026 } 00027 private: 00028 int radius; 00029 int xPosition; 00030 int yPosition; 00031 };
Generated on Thu Jul 14 2022 01:45:10 by
1.7.2