Hi Woody, and Kass,
Wow, great work Woddy, that screen shot is amazing and proof that everything I'm doing is doing absolutely nothing.
Here's another short video showing you my sequence of events.
I don't want to take up any more of your and Kass's time, so at this point, how do you feel about fixing this problem and I can pay you through Paypal, hopefully this isn't frowned upon on this site.
I'm pretty burned out, this is the second bluetooth module that I've tried, and I've been to what seems a thousand - how to sites, so I don't know what to say, except that I want to move forward.
Here's the code that I've been using with the potentiometer and the small stepper.
/*------------------------------------------------------
StepperPot_11
Arduining.com 13 APRIL 2013
A stepper motor follows a potentiometer on analog input 5.
A software low-pass filter is used to reduce the noise in the analog reading.
After 3 seconds of inactivity the motor coils are turned OFF to save energy.
The RED_LED is used to signal when the stepper is powered.
Hardware:
LaunchPad with MSP430G2553.
Driver: ULN2003A
Stepper Motor: 28BYJ48, 5VDC, step pangle 5.625 °
Gear reduction 64:1
No-load starting frequency:> = 500PPS (4 rpm)
Coil resistance 60 Ohms.
-----------------------------------------------------*/
#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPSREV 2047 // 64(fullsteps) * 64 (reduction ratio)
#define COIL1 11
#define COIL2 9
#define COIL3 10
#define COIL4 8
#define POT 0
#define ENER 13
#define TIMEOUT 3000 //Turns off after 3 secs of inactivity.
// create an instance of the stepper class, specifying
// the number of steps per revolution and pins atached to motor coils.
Stepper myStepper(STEPSREV, COIL1, COIL2, COIL3, COIL4);
int PotVal;
int LastPotVal= 0 ; // To implement a software Low-Pass-Filter
int pos = 0; // stepper position(0-4096)->(0-360°)
unsigned long stamp = 0; // last move time stamped.
void setup()
{
myStepper.setSpeed(4); // set the motor speed to 4 RPM
pinMode(ENER, OUTPUT); // status led (coils energized).
// Serial.begin(9600); //for debuging.
}
void loop(){
PotVal = analogRead(POT); // Potentiometer value range 0-1023
PotVal= map(PotVal,0,1023,0,2047); // Map pot range in the stepper range.
PotVal= PotVal * 0.1 + LastPotVal * 0.9 ; // Filtering to reduce noise.
LastPotVal= PotVal;
// Serial.print(Val); // For debuging.
// Serial.print(" "); // "
// Serial.println(pos); // "
// delay(500); // "
if(abs(PotVal - pos)> 4){ //if diference is greater than 4 steps.
if((PotVal - pos)> 0){
digitalWrite(ENER, HIGH); //Motor energized.
myStepper.step(1); // move one step to the right.
pos++;
}
if((PotVal - pos)< 0){
digitalWrite(ENER, HIGH); //Motor energized.
myStepper.step(-1); // move one step to the left.
pos--;
}
stamp = millis(); // stamp actual time.
}
else {
if((millis() - stamp) > TIMEOUT){ //Turn Off coils after TIMEOUT.
digitalWrite(COIL1, LOW);
digitalWrite(COIL2, LOW);
digitalWrite(COIL3, LOW);
digitalWrite(COIL4, LOW);
digitalWrite(ENER, LOW); //Motor de-energized.
}
}
}
Thanks to the both of you again............Antonio