AHHHhhhhh

Dependencies:   ACM1602NI mbed

Files at this revision

API Documentation at this revision

Comitter:
eil4nyqn
Date:
Mon Sep 28 05:36:49 2015 +0000
Child:
1:6ba905bf8eb1
Commit message:
ok

Changed in this revision

ACM1602NI.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/ACM1602NI.lib	Mon Sep 28 05:36:49 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/takuo/code/ACM1602NI/#661827681a12
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 28 05:36:49 2015 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#include "ACM1602NI.h"
+BusIn sw(p6,p8,p21,p10,p23,p12,p24,p22);
+BusIn t(p9,p11);
+BusIn ajust(p29,p30);
+/*
+DigitalIn paul1(p17,PullUp);
+DigitalIn paul2(p18,PullUp);
+DigitalIn paul3(p19,PullUp);
+DigitalIn paul4(p20,PullUp);
+*/
+AnalogIn r(p17);
+AnalogIn l(p15);
+//BusOut led(LED1,LED2);
+BusOut led(p25,p26);
+Serial robo(p13,p14);
+ACM1602NI lcd(p28,p27);
+int main() {
+    char data,ro,lo;
+    int8_t tilt = 0,ajst = 0;
+    double dt,ra,la;
+    t.mode(PullUp);
+    sw.mode(PullUp);
+    ajust.mode(PullUp);
+    while(1) {
+        ra = r;
+        la = l;
+        ro = ((ra-0.20)/0.65)*254;
+        lo = ((la-0.14)/0.68)*254;
+        ajst = ajust;
+        
+        if(t == 2){
+            dt = dt+0.02;
+            led = 1;
+        }
+        if(t == 1){
+            dt = dt-0.02;
+            led = 2;
+        }
+        /*if (paul1 == 0){
+            dt = 10;
+        }
+        if (paul2 == 0){
+            dt = 20;
+        }
+        if (paul3 == 0){
+            dt = -10;
+        }
+        if (paul4 == 0){
+            dt = -20;
+        }*/
+        tilt = dt;
+        data = sw;
+        robo.putc(255);
+        robo.putc(~data);
+        robo.putc(tilt);
+        robo.putc(ro);
+        robo.putc(lo);
+        robo.putc(ajst);
+        robo.putc(~data^tilt^ro^lo);
+        //printf("%d\n\r",~data);
+        //printf("%lf--%lf\n\r",ra,la);
+        printf("%d---%d\n\r",ro,lo);
+        lcd.printf("tiltness :%d\n",tilt);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Sep 28 05:36:49 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file