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.
Diff: main.cpp
- Revision:
- 2:507020c78d79
- Parent:
- 1:c409f3abab09
--- a/main.cpp Fri Jan 03 22:48:18 2014 +0000
+++ b/main.cpp Thu Feb 06 15:37:09 2014 +0000
@@ -1,93 +1,24 @@
#include "mbed.h"
-#define PLATFORM_C027
-#include "arduino.h"
-
-#include "LM75B.h"
-#include "MMA7660.h"
-#include "C12832_lcd.h"
-
-C12832_LCD lcd(ARD_D11,ARD_D13, ARD_D12, ARD_D7, ARD_D10);
-
-DigitalOut redled(ARD_D5);
-DigitalOut blueled(ARD_D8);
-DigitalOut greenled(ARD_D9);
+DigitalOut red_led(D5);
+DigitalOut blue_led(D8);
+DigitalOut green_led(D9);
-LM75B sensor(ARD_SDA,ARD_SCL);
-MMA7660 MMA(ARD_SDA,ARD_SCL);
-
-//DigitalOut spk(ARD_D6);
-
-AnalogIn pot1 (ARD_A0);
-AnalogIn pot2 (ARD_A1);
-
-DigitalIn up(ARD_A2);
-DigitalIn down(ARD_A3);
-DigitalIn left(ARD_A4);
-AnalogIn right(ARD_A5);
-DigitalIn center(ARD_D4);
+DigitalIn up(A2);
+DigitalIn down(A3);
+DigitalIn left(A4);
+AnalogIn right(A5);
+DigitalIn fire(D4);
int main()
{
- redled = 1;
- blueled =1;
- greenled=1;
- int i=0;
-
-while (1) {
- lcd.cls();
- lcd.locate(0,3);
- lcd.printf("woot! %d!",i);
- i++;
- redled = !redled;
- wait(1.0);
+ while (1) {
+ red_led = !up && ! fire;
+ blue_led = !down;
+ green_led= !left && !right;
+ }
}
-
-/*
- while (1) {
- redled = !up && ! center;
- blueled = !down;
- greenled= !left && !right;
- }
-*/
-
- /*
- while (1) {
- redled = 1;
- wait(pot2.read());
- redled = 0;
- wait(pot2.read());
-
- }
-
-
- while(1) {
- lcd.cls();
- lcd.locate(0,3);
- lcd.printf("%.3f %.3f %.3f", pot1.read(),pot2.read(), right.read());
- wait(0.2);
- }
-
-
- while(1) {
- lcd.cls();
- lcd.locate(0,3);
- lcd.printf("Temp = %.3f", (float)sensor);
- lcd.locate(0,14);
- lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z());
- blueled = !blueled;
- greenled = !greenled;
- wait(1.0);
- i++;
-
- }
-
- */
-
-}
-
-