Files at this revision

API Documentation at this revision

Comitter:
kagyroy
Date:
Sat Dec 31 05:22:18 2011 +0000
Parent:
0:1cc4593f62e2
Commit message:
temporary saved project for transmitting to pc

Changed in this revision

include_file.h 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
--- a/include_file.h	Sat Dec 10 10:58:29 2011 +0000
+++ b/include_file.h	Sat Dec 31 05:22:18 2011 +0000
@@ -12,9 +12,3 @@
 DigitalOut  left_P( p15 );
 DigitalOut  left_N( p16 );
 DigitalOut  enable( p19 );
-
-void move_f( float );
-void move_b( float );
-void turn_r( float );
-void turn_l( float );
-void   stop( void );
\ No newline at end of file
--- a/main.cpp	Sat Dec 10 10:58:29 2011 +0000
+++ b/main.cpp	Sat Dec 31 05:22:18 2011 +0000
@@ -2,39 +2,50 @@
 
 int main( int argc, char **argv )
 {
-    char key;
-    float d = 0.5;
-    int width,height,color;
-    
+    int width,height,color;   
     device.baud( 115200 );
+//    device.baud( 9600 );
     right_pwm.period_us( 10 );
     left_pwm.period_us( 10 );
     enable.write( 1 );
     
-  //  device.putc('s');$$$
-    
-    device.printf("f:forward, b:back, r:turn_right\n"
-                  "l:turn_left, a:duty+=0.01, m:duty-=0.01\n");
-                  
-    width = 0;
-    
-    
-    
-    
-    
-    
- //testing area 
-wait( 5 );
+  //  device.putc('s');
+
+   wait( 2 );
+ /*
+   int tempo;
+   for(int i=0; i<10; i++)
+   {
+       for(int j=0; j<10; j++)
+       {
+           tempo = 0;
+           device.printf("a");
+       }
+   } 
+ */
+#define WIDTH 100
+#define HEIGHT 100
 
-//   while( 1 )
-//   {
-       ++width;
-       device.printf("%d\n",width);
-       if(width==255) width = 0;
-       wait_ms( 50 );
-//   }
- 
- 
+width = 0;
+while(1){
+
+   device.printf("s"); //'s'tart signal 
+//   device.printf("%d",WIDTH*HEIGHT); //declaring number of byte(related to frame size)
+//   device.printf("e");  //declare 'e'nd
+   for(int i=0; i<WIDTH; i++)
+   {
+        for(int j=0; j<HEIGHT; j++)
+        {
+           ++width;
+           device.printf("%d\n",width);
+           if(width>=255) width = 0;
+        }   
+        device.printf("h"); //'h'ref: change row
+   }
+   device.printf("t");  //s't'op: frame show enable
+}
+while(1);
+/*
    int frame[200][200][3];
 
    for(int i=0; i<200; i++)
@@ -59,11 +70,7 @@
            }
        }
     }
-
-   
-
-   
-   
+*/   
 /*
    device.printf("s");  //start chara
    for(int i=0; i<200; i++)
@@ -76,98 +83,6 @@
    }
    device.printf("e");  //vertical end
  */  
- //testing area       
-
-  
-  while(1)
-  {
-        key = device.getc();
-        switch( key )
-        {
-            case 'f':
-                move_f( d );
-                break;
-            case 'b':
-                move_b( d );
-                break;
-            case 'r':
-                turn_r( d );
-                break;
-            case 'l':
-                turn_l( d );
-                break;
-            case 's':
-                stop();
-                break;
-            case 'a':
-                d += 0.01;
-                break;
-            case 'm':
-                d -= 0.01;
-                break;
-            default:
-                break;
-        }
-       
-//        device.printf("duty = %1.2f\r", d);
-        
-    }   
+    
 }
-
-void move_f( float d )
-{
-    right_P.write( 0 );
-    right_N.write( 1 );
-    left_P.write( 1 );
-    left_N.write( 0 );
-    right_pwm.write( d );
-    left_pwm.write( d );
-    /*right_pwm.pulsewidth_us( d );
-    left_pwm.pulsewidth_us( d );*/
-}
-
-void move_b( float d )
-{
-    right_P.write( 1 );
-    right_N.write( 0 );
-    left_P.write( 0 );
-    left_N.write( 1 );
-    right_pwm.write( d );
-    left_pwm.write( d );
-    /*right_pwm.pulsewidth_us( d );
-    left_pwm.pulsewidth_us( d );*/
-}
-
-void turn_r( float d )
-{
-    right_P.write( 0 );
-    right_N.write( 1 );
-    left_P.write( 0 );
-    left_N.write( 1 );
-    right_pwm.write( d );
-    left_pwm.write( d );
-    /*right_pwm.pulsewidth_us( d );
-    left_pwm.pulsewidth_us( d );*/
-}
-
-void turn_l( float d )
-{
-    right_P.write( 1 );
-    right_N.write( 0 );
-    left_P.write( 1 );
-    left_N.write( 0 );
-    right_pwm.write( d );
-    left_pwm.write( d );
-    /*right_pwm.pulsewidth_us( d );
-    left_pwm.pulsewidth_us( d );*/
-}
-
-void stop( void )
-{
-    right_P.write( 0 );
-    right_N.write( 0 );
-    left_P.write( 0 );
-    left_N.write( 0 );
-    right_pwm.write( 0 );
-    left_pwm.write( 0 );
-}
\ No newline at end of file
+ 
\ No newline at end of file