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: USBDevice TextLCD mbed
Revision 0:7fda85a1ff8e, committed 2012-06-12
- Comitter:
- _muki
- Date:
- Tue Jun 12 05:06:30 2012 +0000
- Commit message:
- ver.1.0
Changed in this revision
diff -r 000000000000 -r 7fda85a1ff8e TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Tue Jun 12 05:06:30 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/davervw/code/TextLCD/#c5318c74f1a9
diff -r 000000000000 -r 7fda85a1ff8e USBDevice.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Tue Jun 12 05:06:30 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/samux/code/USBDevice/#140cdf8e2d60
diff -r 000000000000 -r 7fda85a1ff8e main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Jun 12 05:06:30 2012 +0000
@@ -0,0 +1,112 @@
+#include "mbed.h"
+#include "USBMouseKeyboard.h"
+#include "TextLCD.h"
+
+USBMouseKeyboard pedal;
+
+TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d0-d3
+
+DigitalOut a_led(LED1);
+DigitalOut b_led(LED2);
+
+DigitalOut powerA(p13);
+DigitalOut powerB(p14);
+
+/*
+InterruptIn Accel(p12);
+InterruptIn Brake(p29);
+*/
+
+DigitalIn Accel(p9);
+DigitalIn Brake(p18);
+
+int accel_flag; // push?
+int brake_flag; // push?
+
+/*
+void Afall(){
+ accel_flag = 0;
+ wait(0.1);
+}
+void Arise(){
+ accel_flag++;
+ wait(0.1);
+}
+void Bfall(){
+ brake_flag = 0;
+ wait(0.1);
+
+}
+void Brise(){
+ brake_flag++;
+ wait(0.1);
+}
+*/
+
+
+int main(void) {
+ int i=0;
+
+ /* debug */
+ a_led = 1;
+ b_led = 1;
+ lcd.printf("hello\n");
+
+
+ /* Initialize */
+ powerA = 1;
+ powerB = 1;
+
+ accel_flag = 0;
+ brake_flag = 0;
+
+
+ /* main Loop */
+ while (1) {
+ /* debug */
+ a_led = accel_flag;
+ b_led = brake_flag;
+
+
+ /* sensing */
+ if(Accel > 0.5){
+ accel_flag = 1;
+ }else{
+ accel_flag = 0;
+ }
+ if(Brake > 0.5){
+ brake_flag = 1;
+ }else{
+ brake_flag = 0;
+ }
+
+
+ /* keyboard input */
+ if(i > 10){
+ lcd.cls();
+ if(accel_flag > 0){
+ lcd.locate(0,0); lcd.printf("A:%d",accel_flag);
+ pedal.printf("\n");
+ }
+
+ if(brake_flag > 0){
+ //pedal.keyCode('', KEY_CTRL);
+ lcd.locate(0,1); lcd.printf("B:%d",brake_flag);
+ pedal.scroll(127); // -128 ~ 127
+ }
+ i = 0;
+ }
+
+ i++;
+ wait(0.1);
+ }
+
+ return 0;
+/* Accel.fall(&Afall);
+ Accel.rise(&Arise);
+ Brake.fall(&Bfall);
+ Brake.rise(&Brise);
+*/
+
+
+}
diff -r 000000000000 -r 7fda85a1ff8e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jun 12 05:06:30 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479