elementary math


i use arduino permit our students opportunity see math in action asking them edit code power stepper on hacked scanner.  if successful, plan build robot navigate course based upon equations.  these elementary students numbers must no greater 3 digits or less little ones.  the code failed attempt achieve goal.  as may guess, not programmer wonder if there way assign value variable within "range" , students can use appropriate operator adjust there.  hope makes sense?

#include <stepper.h>

#define motorstep 400
#define motorpin1 8
#define motorpin2 9
#define motorpin3 10
#define motorpin4 11
#define turn 12

int count;

stepper mystepper(motorstep, motorpin1,motorpin2,motorpin3,motorpin4);

void setup() {
 mystepper.setspeed(40);
 serial.begin(9600);
 count = 1;
 digitalwrite (turn, high);
}

void loop () {
 if (count) {
   count--;
   serial.println ("forward");
   mystepper.step(1500+1400);
   delay(500);
   
   serial.println ("backward");
   mystepper.step(-1500-1400);
   delay(500);
 }
}

quote
is there way assign value variable within "range" , students can use appropriate operator adjust there.  hope makes sense?


hi frank, not clear me want do, can clarify?



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > elementary math


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums