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: C12832 MMA7660 mbed
main.cpp
- Committer:
- ksaito
- Date:
- 2018-01-31
- Revision:
- 0:c3bc6981ad28
- Child:
- 1:2967eac08981
File content as of revision 0:c3bc6981ad28:
#include "mbed.h"
#include "C12832.h"
#include "color.h"
#include "led3.h"
#include "sound.h"
#include "accel.h"
#include "liner.h"
#define JOY_UP (0x01)
#define JOY_DOWN (0x02)
#define JOY_LEFT (0x04)
#define JOY_RIGHT (0x08)
BusIn joy(p15,p12,p13,p16);
DigitalIn fire(p14);
C12832 lcd(p5, p7, p6, p8, p11);
int main()
{
lcd.cls();
lcd.locate(0,3);
lcd.printf("mbed Switches application");
ColorInitialize();
Led3Initialize();
SoundInitialize();
AccelInitialize();
LinerInitialize();
while(true) {
char* message = NULL;
if (fire) {
message = "Fire!";
Led3Process();
} else {
switch (joy) {
case JOY_UP: {
message = "Up!";
SoundProcess();
SoundFinalize();
break;
}
case JOY_DOWN: {
message = "Down!";
AccelProcess();
break;
}
case JOY_LEFT: {
message = "Left!";
ColorProcess();
ColorFinalize();
break;
}
case JOY_RIGHT: {
message = "Right!";
LinerProcess();
break;
}
default: {
message = NULL;
break;
}
}
}
if (message != NULL) {
lcd.locate(0,15);
lcd.printf(" ");
lcd.locate(0,15);
lcd.printf(message);
}
}
}