[Lab] Roll call for tonight's modlab ...

Darcy Whyte darcy at siteware.com
Wed Jul 20 13:36:52 EDT 2011


I'm going to be floating around. I'm bringing a case of water.

And a drawbot. Anybody want to have a whirl at tweaking the program?

It's pretty simple. It uses the random function to come up with motor turns
and then tries to stay on the page using some upper and lower bounds.



#include <AFMotor.h>

AF_Stepper motor(48, 1);
AF_Stepper motor2(48, 2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");


  motor.setSpeed(280);  // 10 rpm
  motor2.setSpeed(280);
 // motor.setSpeed(280);  // 10 rpm
 // motor2.setSpeed(280);
}

int x=0;
int y=0;

int xBound = 1000;
int yBound = 1000;

int dx;
int dy;
int xd;
int yd;

void loop() {

 dx = random (0,500);
 dy = 1000-dx + random (0, 100);
 //dy = random (0,500);
 xd = random (0, 100);
 yd = random (0, 100);
// xd = 1;
 //yd = 1;

 if (xd > 50) {
   if (x <= xBound) {
     motor.step(dx, FORWARD, INTERLEAVE);
     x = x + dx;
   } else {

   }
 } else {
   if (x >= -xBound) {
     motor.step(dx, BACKWARD, INTERLEAVE);
     x = x - dx;
   } else {

   }
 }
 if (yd > 50) {
   if (y <= yBound) {
     motor2.step(dy, FORWARD, INTERLEAVE);
     y = y + dy;
   } else {

   }
 } else {
   if (y >= -yBound) {
     motor2.step(dy, BACKWARD, INTERLEAVE);
     y = y - dy;
   } else {

   }
 }

  //motor.step(1500, BACKWARD, INTERLEAVE);
  //motor2.step(1500, BACKWARD, INTERLEAVE);


}


  //Serial.println("Single coil steps");
  //motor.step(10000, FORWARD, SINGLE);
  //motor.step(100, BACKWARD, SINGLE);

  //Serial.println("Double coil steps");
  //motor.step(10000, FORWARD, DOUBLE);
  //motor.step(100, BACKWARD, DOUBLE);

  //Serial.println("Interleave coil steps");

  //#ifdef MICROSTEPPING
//  Serial.println("Micrsostep steps");
//  motor.step(100, FORWARD, MICROSTEP);
//  motor.step(100, BACKWARD, MICROSTEP);
//#endif








On Wed, Jul 20, 2011 at 1:02 PM, Jean-Claude Batista <
jeanclaudebatista at gmail.com> wrote:

> Heat shouldn't prevent some soldering fun!
>
> You can RSVP using the following link: http://bit.ly/qYrZOl
>
> /jc
> On Wed, Jul 20, 2011 at 10:52 AM, Bruce <lists at faintfuzzies.ca> wrote:
>
>> On July 20, 2011 08:06:42 AM Andrew Plumb wrote:
>> > Anyone else planning to be there tonight, besides myself?
>> >
>> > Andrew.
>> >
>> > --
>> _______________________________________________
>> Lab mailing list
>> Lab at artengine.ca
>> http://artengine.ca/mailman/listinfo/lab
>>
>
>
> _______________________________________________
> Lab mailing list
> Lab at artengine.ca
> http://artengine.ca/mailman/listinfo/lab
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://artengine.ca/pipermail/lab/attachments/20110720/05d6839a/attachment.htm>


More information about the Lab mailing list