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 Physac-MBED PinDetect SDFileSystem mbed-rtos mbed
main.cpp
- Committer:
- jstephens78
- Date:
- 2022-11-30
- Revision:
- 12:5d913b57da7c
- Parent:
- 11:e00a208bd85a
- Child:
- 16:6cf744b2623a
File content as of revision 12:5d913b57da7c:
#include "mbed.h"
#include "rtos.h"
#include "globals.h"
#include "hockey.h"
//#include "Speaker.h"
#include "SDFileSystem.h"
#include "uLCD_4DGL.h"
//SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
DigitalOut myled(LED1);
//AnalogOut DACout(p20);
//PwmOut Rgb(p23);
//PwmOut rGb(p24);
//PwmOut rgB(p25);
//PwmOut PWMout(p21);
//wave_player waver(&DACout);
uLCD_4DGL uLCD(p9,p10,p30);
BluefruitController blue(p13,p14);
volatile bool game1 = false;
volatile bool game2 = false;
/*
void thread3(void const *argument)
{
FILE *wave_file;
PWMout.period(1.0/400000.0);
while (game1 == false && game2 == false) {
wave_file=fopen("/sd/MiiMenu.wav","r");
waver.play(wave_file);
fclose(wave_file);
}
while (game1 == true && game2 == false) {
wave_file=fopen("/sd/tetris.wav","r");
waver.play(wave_file);
fclose(wave_file);
}
while (game2 == true && game1 == false) {
wave_file=fopen("/sd/WiiPlayAirHockey.wav","r");
waver.play(wave_file);
fclose(wave_file);
}
}
void thread4(void const *argument)
{
float x = 0.0;
while(1) {
//get a new random number for PWM
x = rand() / float(RAND_MAX);
//add some exponential brightness scaling
//for more of a fast flash effect
x = x*x*x;
Rgb = x;
rGb = x;
rgB = x;
//fast update rate for welding flashes
Thread::wait(20);
//add a random pause between welds
if (rand() / float(RAND_MAX) > 0.95) {
Rgb = 0;
rGb = 0;
rgB = 0;
Thread::wait(4000.0 * rand() / float(RAND_MAX));
}
}
}
*/
int main()
{
printf("Starting thread 2\r\n");
game2 = true;
Thread thread2(hockeyGame);
//Thread thread3(thread3);
//Thread thread4(thread4);
printf("Blinking LED:\r\n");
while (true) {
myled = 1;
Thread::wait(500);
myled = 0;
Thread::wait(500);
}
}