/* A program to drive a couple of stepper motors */ /* String Art */ #include #include #include #include "libesketch.h" int main( int argc, char **argv ) { int i; int xm = 1000; /* Screen X maximum */ int ym = 650; /* Screen Y maximum */ int xc = 500; /* Screen center X coordinate */ int yc = 350; /* Screen center Y coordinate */ printf( "Usage: string [x_max y_max]\n" ); if( argc == 3 ) { xm = atoi( argv[1] ); ym = atoi( argv[2] ); } /* Init libesketch */ init(); /* Calculate screen center coordinates */ xc = xm / 2; yc = ym / 2; for( i = 0; i < ym; i += 20 ) { /* Draw a square */ drawto( i, 0 ); drawto( ym , i ); drawto( ym - i, ym ); drawto( 0, ym - i ); drawto( i, 0 ); } /* Turn off motor drivers */ stop(); return 0; }