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: mbed wave_player 4DGL-uLCD-SE MMA8452
Diff: hardware.cpp
- Revision:
- 2:06c63d567719
- Parent:
- 1:399033d39feb
--- a/hardware.cpp Wed Apr 04 21:11:07 2018 +0000
+++ b/hardware.cpp Fri Nov 30 02:53:05 2018 +0000
@@ -10,12 +10,13 @@
// Hardware initialization: Instantiate all the things!
uLCD_4DGL uLCD(p9,p10,p11); // LCD Screen (tx, rx, reset)
-//SDFileSystem sd(p5, p6, p7, p8, "sd"); // SD Card(mosi, miso, sck, cs)
+SDFileSystem sd(p5, p6, p7, p8, "sd"); // SD Card(mosi, miso, sck, cs)
Serial pc(USBTX,USBRX); // USB Console (tx, rx)
MMA8452 acc(p28, p27, 100000); // Accelerometer (sda, sdc, rate)
DigitalIn button1(p21); // Pushbuttons (pin)
DigitalIn button2(p22);
DigitalIn button3(p23);
+DigitalIn button4(p24);
AnalogOut DACout(p18); // Speaker (pin)
PwmOut speaker(p26);
wave_player waver(&DACout);
@@ -32,12 +33,20 @@
button1.mode(PullUp);
button2.mode(PullUp);
button3.mode(PullUp);
-
+ button4.mode(PullUp);
return ERROR_NONE;
}
GameInputs read_inputs()
{
GameInputs in;
+ in.b1 = button1;
+ in.b2 = button2;
+ in.b3 = button3;
+ in.b4 = button4;
+ acc.readXGravity(&in.ax);
+ acc.readYGravity(&in.ay);
+ acc.readZGravity(&in.az);
+ //pc.printf("%d,%d,%d\r\n",in.ax,in.ay,in.az);
return in;
}