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.
Paddle.h
00001 00002 /** 00003 @file Paddle.h 00004 @brief Header file containing functions. 00005 */ 00006 /**Identifications for the paddle library. 00007 */ 00008 #ifndef PADDLE_H 00009 #define PADDLE_H 00010 00011 #include "mbed.h" 00012 #include "N5110.h" 00013 00014 /** 00015 @brief This library has been made to allow the paddle to update, check its position .etc This will make the coding later on in the main file a bit easier to manipulate. 00016 @brief Revision 1.0 00017 @author Jefferson Sanchez 00018 @date April 2016 00019 **/ 00020 00021 // the class is used to store a type of variable in this case the variable is the “paddle" 00022 class Paddle 00023 { 00024 int x1, x2, y1, y2;// the integers are x and y 00025 public: 00026 /** The following show the connections to the K64F 00027 * 00028 * @param pin connected to PTB3 in a Digital Input 00029 * @param Pin Connected to PTB2 in a Digital Input 00030 * @param Pin connected to +5v and GND to be able to obtain a interger value. 00031 * 00032 */ 00033 Paddle(int x_1, int x_2, int y_1, int y_2) : x1(x_1), x2(x_2), y1(y_1), y2(y_2) {} 00034 /** Checks to see what pixels are on in the X coordinate for player 1 and returns a value for X1. 00035 */ 00036 int lookforX1(); 00037 /** Allows to check to see what pixels are on in the X coordinate for player 2 and returns a value for X2. 00038 */ 00039 int lookforX2(); 00040 /** Checks to see what pixels are on in the Y coordinate for player 1 and returns a value for Y1 . 00041 */ 00042 int lookforY1(); 00043 /** Check to see what pixels are on in the Y coordinate for player 2 and returns a value for Y2. 00044 */ 00045 int lookforY2(); 00046 /** Once the coordinates have been obtained it will display them on the lcd. 00047 * for(int i = y1; i <= y2; i++) 00048 * { 00049 * display.setPixel(x1, i); 00050 * display.setPixel(x2, i); 00051 * } 00052 00053 display.refresh(); 00054 } 00055 */ 00056 void YPaddle(N5110 &display); 00057 /** Once the coordinates have been obtained it will update the display when the paddle moves. 00058 */ 00059 void Moving_Paddle(N5110 &display); 00060 /** This function allow me to refresh the position of Player 1 */ 00061 void Refresh_pos(AnalogIn &p1); 00062 00063 }; 00064 00065 #endif
Generated on Thu Jul 21 2022 10:50:37 by
1.7.2