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.
Ball.h
00001 /** 00002 @file Ball.h 00003 @brief Header file containing functions for the ball. 00004 00005 */ 00006 00007 #ifndef BALL_H 00008 #define PADDLE_H 00009 00010 #include "mbed.h" 00011 #include "N5110.h" 00012 00013 /** 00014 @brief This library has been made to allow the ball to update, check its position. etc This will make the coding later on in the main file a bit easier to manipulate. 00015 @brief Revision 1.0 00016 @author Jefferson Sanchez 00017 @date April 2016 00018 **/ 00019 00020 class ball 00021 { 00022 /** Ball will give me the integers for x1,y1,xi position, y1 position . 00023 */ 00024 int x, y; 00025 int x_Pos_state, y_Pos_state; 00026 public: 00027 /** Ball will give me the integers for x1,y1,x1 position, y1 position . 00028 * @param pin connected to PTB3 in a Digital Input 00029 * @param Pin Connected to PTB2 in a Digital Input 00030 * @param Pins connected to +5v and GND to be able to obtain an integer value. 00031 */ 00032 ball(int x1, int y1, int x1_Pos_state, int y1_Pos_state) : x(x1), y(y1), x_Pos_state(x1_Pos_state), y_Pos_state(y1_Pos_state) {} 00033 00034 /** Switches a pixel on in a particular coordinate in the X axis. 00035 * 00036 * ball.setX(41); 00037 */ 00038 void setX(int value); 00039 /** Switches a pixel on in a particular coordinate in the Y axis. 00040 * 00041 * ball.setY(23); 00042 * 00043 */ 00044 void setY(int value); 00045 /** Switches a pixel on in a particular coordinate in the X axis. 00046 * 00047 * ball.setY(23); 00048 * 00049 */ 00050 int lookforX(); 00051 /** 00052 *@param Allows me to check to see what pixels are on in the Y coordinate. 00053 @returns y value. 00054 */ 00055 int lookforY (); 00056 /** 00057 *@param Checks the position state on the X coordinate. 00058 *@returns x position state. 00059 */ 00060 int lookforPos_stateX (); 00061 /** Checks the position state on the Y coordinate. 00062 @returns y position state. 00063 */ 00064 int lookforPos_stateY(); 00065 /** Checks the Collisions state on the X and Y coordinates. 00066 */ 00067 00068 void BallcollisionState(int xPos_state, int yPos_state); 00069 /** Diameter of the ball. 00070 */ 00071 void dbal(N5110 &display); 00072 /** States the clearing of pixels for the ball as it moves 00073 */ 00074 void clear_dbal(N5110 &display); 00075 /** This is used to refresh the position of the ball. 00076 */ 00077 void Refresh_pos(); 00078 00079 }; 00080 00081 #endif
Generated on Thu Jul 21 2022 10:50:37 by
1.7.2