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: N5110 Ping_Pong beep mbed Servo
Revision 9:80898ce9d4d5, committed 2017-04-15
- Comitter:
- el14jpps
- Date:
- Sat Apr 15 18:47:27 2017 +0000
- Parent:
- 8:c3964f59f01c
- Commit message:
- sencod
Changed in this revision
--- a/Games_functions/G_of_Life/Game.cpp Sat May 07 15:51:29 2016 +0000
+++ b/Games_functions/G_of_Life/Game.cpp Sat Apr 15 18:47:27 2017 +0000
@@ -13,7 +13,7 @@
//Libraries needed
#include "mbed.h" // the Mbed library required to run certain functions.
#include "N5110.h"// This are the functions needed to execute the display1.
-#include "beep.h"
+#include "beep.h"
//--------------------------------------------------------------------------------------------------------------------------//
// The microcontroller used with programs was the FRDM-k64F.
@@ -1125,11 +1125,11 @@
sw3.mode (PullUp);// Use internal pullup for pushbutton
sw3.fall(&sw3_interrupt); // it interuts the game by adding a glider and a spaceship
- /*
+/*
////////////////////////////////////////////////////////////////////////////////////////////////////////
change.mode (PullUp);// Use internal pullup for pushbutton
change.fall(&change1); // it interuts the game
- */
+ */
wait(pot);
display1.setBrightness(pot3);
--- a/Games_functions/G_of_Life/Game_of_life.h Sat May 07 15:51:29 2016 +0000
+++ b/Games_functions/G_of_Life/Game_of_life.h Sat Apr 15 18:47:27 2017 +0000
@@ -1,6 +1,6 @@
/**
@file Game_of_life.h
-@brief This is simple simplification of the whole code for the game of life into a header file that allows me for easy use of the functions across other files such as my main for my menu.
+@brief This is simple simplification of the whole code for the game of life into a header file that allows me for easy use of the functions across other files such as my main for my menu.
*/
#include "mbed.h"
#include "N5110.h"
@@ -9,40 +9,40 @@
/**
@brief This is My Game of life made into a header file that allows me to used it across all three codes for my project.
@brief Revision 1.2
-@author Jefferson Sanchez
+@author Jefferson Sanchez
@date march 2016
**/
-/** Pattern
+/** Pattern
* this is the function for the picture of myself.
*/
void myself();
- /** Function for the rules of life.*/
+/** Function for the rules of life.*/
void Liferules();
- /** Pattern A simple blinker pattern
- */
+/** Pattern A simple blinker pattern
+ */
void blinker();
- /** Pattern "Mothership"
- */
+/** Pattern "Mothership"
+ */
void navemadre();
-/** Pattern of a isolator of 3 pixels
+/** Pattern of a isolator of 3 pixels
*/
void isolator ();
- /** Pattern that shoots gliders from the top left of the screen to the right hand side .
- */
-void gun();
+/** Pattern that shoots gliders from the top left of the screen to the right hand side .
+ */
+void gun();
/** Pattern of a space ship
*/
void ship();
- /** The wall is what makes the gliders in to squares etc. ... it is used as boundaries conditions
- */
+/** The wall is what makes the gliders in to squares etc. ... it is used as boundaries conditions
+ */
void wall();
- /** Pattern of a small boat as a still life
- */
+/** Pattern of a small boat as a still life
+ */
void boat();
- /** Pattern of a watch, I personally think it is facinating
- */
+/** Pattern of a watch, I personally think it is facinating
+ */
void reloj();
-/**
+/**
*This function is used to interrupt the game and place 4 gliders every time the player wants
*/
void sw2_hit_interrupt();
@@ -50,16 +50,16 @@
*Used to interrupt the game and place a ship
*/
void sw3_interrupt();
-/** Pattern
+/** Pattern
*/
void lineb_hit_interrupt();
-/** Introduction before the game starts
+/** Introduction before the game starts
*/
void intro();
-/** Function containing all the pull modes for the function
+/** Function containing all the pull modes for the function
*/
void buttons();
-/** It contains the main as a while loop for the game of life this allows me to use this function within the menu by just calling it from this header file.
+/** It contains the main as a while loop for the game of life this allows me to use this function within the menu by just calling it from this header file.
*/
void gameOfLife();
/** Used for power management */
@@ -79,8 +79,8 @@
Liferules();
blinker();
buttons();
- wall();
- //sleep();// Used for Power Management
+ wall();
+ sleep();// Used for Power Management
}
}
--- a/Games_functions/PING_PONG/pong.cpp Sat May 07 15:51:29 2016 +0000
+++ b/Games_functions/PING_PONG/pong.cpp Sat Apr 15 18:47:27 2017 +0000
@@ -203,9 +203,9 @@
ball.setX(41);
ball.setY(23);
ball.BallcollisionState(2, 1);
- if(p2_score == 10)
+ if(p2_score == 10){
+ noise_point();
point = true;
- else if (point == true) {
noise_point();
} else return;
}
@@ -231,9 +231,9 @@
ball.setX(41);
ball.setY(23);
ball.BallcollisionState(-2, 1);// it selects the distance of the ball from the paddle when collision is made.
- if(p1_score == 10)
+ if(p1_score == 10){
+ noise_point();
point = true;
- else if (point == true) {
noise_point();
} else return;
}
--- a/Games_functions/PING_PONG/pong.h Sat May 07 15:51:29 2016 +0000
+++ b/Games_functions/PING_PONG/pong.h Sat Apr 15 18:47:27 2017 +0000
@@ -12,6 +12,7 @@
Beep pong_noise(PTA2);
void noise_point()
{
+ wait(0.2);
pong_noise.beep(1000,0.5);
pong_noise.beep(1100,0.5);
pong_noise.beep(1000,0.5);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Sat Apr 15 18:47:27 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/simon/code/Servo/#36b69a7ced07
--- a/main.cpp Sat May 07 15:51:29 2016 +0000
+++ b/main.cpp Sat Apr 15 18:47:27 2017 +0000
@@ -131,7 +131,7 @@
display.printString("PING PONG[o]",5,2);
display.printString("G of Life",5,3);
display.printString("Credits",5,4);
- //buzzer.beep(500,0.5);
+
serial.printf("ping pong \n");
/**
*As shown bellow I have used a interrupt for the g_switch2_flag to show that the selection can be done using two diferent methods.
@@ -140,6 +140,7 @@
if (g_switch2_flag) {
g_switch2_flag = 0;
pongGame();
+
}
/**
* As described above the button funtion is controlled by PTB11 Joy stick button
@@ -149,6 +150,7 @@
//tone1();
yellow =1;
light();
+ buzzer.beep(500,0.5);
pongGame();
}
@@ -183,6 +185,7 @@
tone2();
green=1;
light();
+
gameOfLife();
}
--- a/menu_funtions/menu.h Sat May 07 15:51:29 2016 +0000
+++ b/menu_funtions/menu.h Sat Apr 15 18:47:27 2017 +0000
@@ -21,20 +21,21 @@
lcd1.setBrightness(0);
wait(1);
lcd1.setBrightness(1);
+ buzzer.beep(500,0.5);
lcd1.printString("LOADING. ",5,2);
wait(1);
- //buzzer.beep(1500,0.5);
lcd1.setBrightness(0);
wait(1);
lcd1.setBrightness(1);
lcd1.clear();
+ buzzer.beep(500,0.5);
lcd1.printString("LOADING.. ",5,2);
- // buzzer.beep(1000,0.5);
lcd1.setBrightness(1);
wait(1);
lcd1.setBrightness(0);
wait(1);
lcd1.clear();
+ buzzer.beep(500,0.5);
lcd1.printString("LOADING...",5,2);
// buzzer.beep(900,0.5);
lcd1.setBrightness(1);