エレキジャック Web版 マイコン・カーを製作してみよう<8>で紹介したサーボを制御するプログラムです。http://www.eleki-jack.com/arm/2012/05/8.html

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
sunifu
Date:
Tue May 08 03:42:42 2012 +0000
Commit message:
1.0

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Tue May 08 03:42:42 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 08 03:42:42 2012 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+DigitalIn left(p19);
+DigitalIn right(p20);
+PwmOut servo(p21);
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+
+int main() {
+    lcd.cls( );
+    servo.period(0.04);
+    while(1) {
+        lcd.locate(0,0);
+        if ( left == 1 ){
+            lcd.printf("Left  ");
+            servo.pulsewidth_us(1200);
+        }else if ( right == 1 ){
+            lcd.printf("Right ");
+            servo.pulsewidth_us(1800);
+        }else{
+            lcd.printf("      ");
+            servo.pulsewidth_us(1500);
+        }       
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 08 03:42:42 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b4b9f287a47e