Show Posts
Pages: [1] 2 3 ... 8
1  Using Arduino / Programming Questions / Re: accelstepper functions and control help on: July 09, 2014, 12:57:09 am
does any one have a library or stepper controlling example code that i cold use to learn some other ways of setting up this function
i have looked therew all the examples that came with the accelstepper lib,..  and such but  seeing some other uses of the code could help i think ,.. thank you for your time to guys ! and girls ,..
2  Using Arduino / Programming Questions / Re: accelstepper functions and control help on: July 09, 2014, 12:54:03 am
ok so you are suggesting that  i should use another method for control of the steps ,... keep in mine im barely learning here haha and mixing and matching the library's seem scary ! But the thought did cross my mind if i could still use the the af motor  libirey the way it was working but re write  the  library to send the pules to 2 data pains that the drivers could use and add a high low function in the main code for direction but when i looked at the library it was a vast intimidating wealth of code simple for some im sure but with out ever taking a c++ class in my life i don't know if it even posable  .

3  Using Arduino / Microcontrollers / Re: attiny 85 ping sensor on: July 08, 2014, 07:27:20 pm
that they are!,  and that makes sense too  i guess 70ms is an ok sacrifice i wonder if you could just send a specific ping per sensor and if that would make the timeing better or worse ?   example  :

sensor 1  ping 2 times
 wait for 2 pings back calculate time }

sensor 2 ping 4 times quickly
 wait for 4 quick pings back calculate time }

sensor 3 ping 6 times quickly
 wait for 6 quick pings back calculate time }

then maybe you could fire all there when ever you want ?

idk,.... it way over my head in math formulas and code,...
4  Using Arduino / Programming Questions / Re: accelstepper functions and control help on: July 08, 2014, 06:56:16 pm
to anser my firends up there above the code ,... i have been trying to use the accel stepper  lib.. for a long time i am yet to find a good brake down of how it works ans what the diffrance is from afmotor,,,  i have skimmed threw the forum, but it seems that this same topic comes up gets one reply or a few specific ansewer to some ones project and program code  and then the  feed of the topic stops there..

 i have found a site that has some functions i have not tried yet .
http://www.airspayce.com/mikem/arduino/AccelStepper/

but still does not explain the use or difference, due to it being a different subject .


Quote
Do you need to be able to drive more than one stepper at a time? Do you need to control the acceleration of the stepper? If the answer to both of these questions is no, then use Stepper, rather than AccelStepper. Stepper has a far simpler API.
AS for needing to run 2 motors yes i do need 2 motors ! yes i need to run 2 of them BUT not at the same time controling one or the other is working fine ..
thanks !
5  Using Arduino / Programming Questions / Re: accelstepper functions and control help on: July 08, 2014, 06:42:16 pm
then a loop code much like that one just runs threw the loop reading the labels and  feeding new sheets over and over .


Code:
viod loop{

  // debuging reads
  Serial.println(drawbar);
  Serial.println("TAG 1!");
  int TAG1 = analogRead(A0); // read the input on analog pin 0:
  Serial.println(TAG1); // print out the value you read:
  Serial.println("TAG 2!");
  int TAG2 = analogRead(A1);
  Serial.println(TAG2);
  Serial.println("TAG 3!");
  int TAG3 = analogRead(A2);
  Serial.println(TAG3);
  Serial.println("TAG 4!");
  int TAG4 = analogRead(A3);
  Serial.println(TAG4);
  Serial.println("WAIT!");
  motor1.release();
  motor2.release();

  digitalWrite(ERROR, LOW);
  int button01 = analogRead(A4);// check if the pushbutton is pressed.?if it is, the buttonState is HIGH:
  // PULL UP FIRST SET ON SHEET
  while (button01 > 700) {
    Serial.println("WAITING ON button 1 press!");
    digitalWrite(papperfeedingled, LOW);
    button01 = analogRead(A4);
    delay(150);
    digitalWrite(papperfeedingled, HIGH);
    delay(150);
  }
  Serial.println("button 1 pressed!");

  // PULL UP FIRST SET ON SHEET
  // MOVE ONE LARGE LABLE AND WAIT
  digitalWrite(papperfeedingled, HIGH); // turn LED on:
  motor2.setSpeed(290);
  motor2.step(845, BACKWARD, DOUBLE);//   1500 steps is aproxmitly 1.375 inchs  .025 short of next notch
  Serial.print("feeding SET 1 :" );
  //SLACK OR WEB SKIP
  motor1.setSpeed(250);
  motor1.step(10, BACKWARD, SINGLE);
  delay(500);
  motor1.release();
  motor2.release();
  //END OF ONE LARGE
  digitalWrite(papperfeedingled, LOW);



  // MOVE ONE LARGE LABLE AND WAIT
  digitalWrite(papperfeedingled, HIGH); // turn LED on:
  motor2.setSpeed(250);
  motor2.step(1075, BACKWARD, DOUBLE);//   1500 steps is aproxmitly 1.375 inchs  .025 short of next notch
  Serial.print("feeding SET 2:" );
  //SLACK OR WEB SKIP
  motor1.setSpeed(250);
  motor1.step(10, BACKWARD, SINGLE);
  delay(50);
  motor1.release();
  motor2.release();
  //END OF ONE LARGE LABEL MOVE

  digitalWrite(papperfeedingled, LOW);
  //END OF ONE LARGE set 2



  // spend the end of the sheet thru rollers
  Serial.println("SPEND END OF 800 STEP SHEET DELAY !");
  motor2.setSpeed(300);
  motor2.step(1100, BACKWARD, SINGLE);//20 per failed W-loop FAIL
  motor2.release(); //allows lower power usage and lesS heating of driver and motor
  motor1.release();


  // enter stage for loading new sheet !


  Serial.println("LOAD NEW SHEET DELAY !");
  delay(400);

  // waiting  ON PERSON READY CHECK POINT
  button01 = analogRead(A4);
  while (button01 > 700) {
    digitalWrite(papperfeedingled, HIGH);
    delay(150);

  
6  Using Arduino / Programming Questions / Re: accelstepper functions and control help on: July 08, 2014, 06:38:58 pm
 first i would like to thank you for looking in to my topic ,,  ill post the code i used with the afmotor shield and maybe that can shed some light on whats going on ...


old code Warning im not a pro
Code:

// 2 stepper machije used to peel labels from backing


#include <AFMotor.h>
#include <Stepper.h>

AF_Stepper motor1(48, 1);// using this any more
AF_Stepper motor2(48, 2);// <--- this ch is hooked to the stepper moveing
//ir sensor left to right
int TAG1 = A0;
int TAG2 = A1;
int TAG3 = A2;
int TAG4 = A3;
//humaninterface case buttons 1 and 2
int button01 = A4;
int button02 = A10;
//optosensor has a pair of components consisting of a matched IR transmitter and receiver built in
int papercheck = A11;
int drawbar = A12;
//3 useable leds
int papperfeedingled = A13;
int ERROR = A14;
int learnled = A15;
// thats all for pin use

int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button
int waittime = 0;
int set1 = 0;
int set2 = 0;
int set3 = 0;
int set4 = 0;
int set5 = 0;
int stepCount = 0;


void setup() {
  Serial.begin(9600);
  //set up pins THAT ARE OUTPUTS
  pinMode(papperfeedingled, OUTPUT);
  pinMode(learnled, OUTPUT);
  pinMode(ERROR, OUTPUT);
  //set up input pins
  pinMode(button01, INPUT);
  pinMode(button02, INPUT);
  pinMode(papercheck, INPUT);
  pinMode(drawbar, INPUT);
  pinMode(TAG1, INPUT);
  pinMode(TAG2, INPUT);
  pinMode(TAG3, INPUT);
  pinMode(TAG4, INPUT);

  // spend the end of the sheet thru rollers
  motor2.setSpeed(400);
  motor2.step(350, FORWARD, SINGLE);//20 per failed W-loop FAIL 3500 WAS NOTE
  motor2.release(); //allows lower power usage and lesS heating of driver and motor
 delay(400);//DELAY START


  //check draw bar empty carriage position
  Serial.println("drawbar read!");
  int drawbar = analogRead(A12);
  Serial.println(drawbar);// PRINT TO SERIAL CONECTION FOR DEBUGING



  // home out on power up
  while (drawbar < 200) {
    drawbar = analogRead(A12);
    motor1.setSpeed(300);
    motor1.step(24, FORWARD, SINGLE);//20 per failed W-loop FAIL
    digitalWrite(ERROR, HIGH);
    delay(4);
    // print out A NEW value FROM read:
    Serial.println("drawbar set !!");
    Serial.println(drawbar);
    int drawbar = analogRead(A12);
  }

  digitalWrite(ERROR, LOW);
  delay(50);
  digitalWrite(papperfeedingled, LOW);
  motor1.release();//disables the H-brige to release coils on motor
  motor2.release(); //allows lower power usage and lesS heating of driver and motor






  // waiting  ON PERSON READY CHECK POINT
  int button01 = analogRead(A4);
  while (button01 > 700) {
    digitalWrite(papperfeedingled, HIGH);
    delay(150);
    digitalWrite(papperfeedingled, LOW);
    delay(120);
    Serial.println("waitin on button press to start feed tray!");
    Serial.println(waittime);


    button01 = analogRead(A4);
  }
  digitalWrite(papperfeedingled, LOW);

  //check and wait for label sheets
  //PAPERCHECK WHILE LOOP
  papercheck = analogRead(A11);
  while (papercheck < 200) {

    digitalWrite(ERROR, HIGH);
    delay(100);


    papercheck = analogRead(A11);
    delay(100);

    // print out the value you read:
    Serial.println(papercheck);
    delay(100);
  }
  digitalWrite(ERROR, LOW);


  // IR RAIL TEST CHECK TO SEE IF IR RAIL IS IN LOCKED POS AND WAIT FOR IT TO BE SO

  // READ AND WAIT ON ALL 4 IR POS TO OPEN UP
  TAG1 = analogRead(A0);
  while (TAG1 < 350) {
    digitalWrite(ERROR, HIGH);
    delay(250);

    Serial.println("WAIT ON OPENING POS #4 !");
    delay(200);
    TAG1 = analogRead(A0);
    Serial.println(TAG1);
    delay(50);

  }
  digitalWrite(learnled, LOW);
  TAG2 = analogRead(A1);
  while (TAG2 < 350) {
    digitalWrite(ERROR, HIGH);
    delay(250);

    digitalWrite(learnled, HIGH);
    Serial.println("WAIT ON OPENING POS #3 !");
    delay(200);
    TAG2 = analogRead(A1);
    Serial.println(TAG1);
    delay(200);
    digitalWrite(learnled, LOW);
  }
  digitalWrite(learnled, LOW);
  TAG3 = analogRead(A2);
  while (TAG3 < 350) {
    digitalWrite(ERROR, HIGH);
    delay(250);

    Serial.println("WAIT ON OPENING POS #2 !");
    delay(200);
    TAG3 = analogRead(A2);
    Serial.println(TAG3);
    delay(200);
    digitalWrite(learnled, LOW);
  }
  digitalWrite(learnled, LOW);
  TAG4 = analogRead(A3);
  while (TAG4 < 350) {
    digitalWrite(ERROR, HIGH);
    delay(250);

    Serial.println("WAIT ON OPENING POS #1 !");
    delay(200);
    TAG4 = analogRead(A3);
    Serial.println(TAG4);
    delay(200);
    digitalWrite(learnled, LOW);
  }
  digitalWrite(learnled, LOW);
  //END OF IR 4 POS WAITING
  delay(1000);
  digitalWrite(ERROR, LOW);
  digitalWrite(learnled, LOW);


  // READ TAG SENSOR STATE RECORD AND COMPAIR VALUE
  Serial.println("TAG1 read!");//PRINT A LABEL FOR THIS READ
  int TAG1 = analogRead(A0);//READ
  Serial.println(TAG1);// PRINT ACTUALE VALUE STATE FOR DEBUGING
  delay(100);//DELAY PAPPER FEED
  papercheck = analogRead(A11);

  delay(500);

  //FEED PAPPER TILL IR EYE SENSOR CHANGES STATE
  while (TAG1 > 200) {
    // SET SENSOR LED AND READ IR
    digitalWrite(papperfeedingled, HIGH);
    TAG1 = analogRead(A0);

    // MOTOR MOVMENT
    motor1.setSpeed(300);
    motor1.step(4, BACKWARD, DOUBLE);// STEP MOTOR 8 times  PER W-LOOP FAIL
    digitalWrite(papperfeedingled, LOW);
    //DEBUGING IR SENSOR VALUES
    // print out A NEW value FROM read:
    Serial.println("BEFORE!");
    Serial.println(TAG1);
    int TAG1 = analogRead(A0);
    // print out the value you read:
    Serial.println("TAG1 NOW!");
    Serial.println(TAG1);
    digitalWrite(papperfeedingled, LOW);
  }
  delay(50);
  digitalWrite(papperfeedingled, LOW);
  motor1.release();//disables the H-brige to release coils on motor
  motor2.release(); //allows lower power usage and lesS heating of driver and motor

  //PRINT A NEW DEBUGING VALUE
  Serial.println("PAPER FOUND AT IR READ !");
  Serial.println(TAG1);
  delay(10);

  //AFTER IR READS A STATE CHANGE FOLLOW THESE STEPS TO DRAW THE BACKING SHEET TO PINCH ROLLERS AND SET UP FOR PEELING
  motor1.setSpeed(240);
  motor1.step(106, BACKWARD, DOUBLE);//OFF SET FOR BRAKEING DRAWBAR
  delay(10);
  motor1.release();
  motor2.release();



  //DRAW BAR ENGAGE
  //  //DRAW BAR ENGAGE
  while (drawbar > 200) {
    drawbar = analogRead(A12);
    motor1.setSpeed(200);
    motor1.step(20, FORWARD, DOUBLE);//20 per failed W-loop FAIL
    // print out A NEW value FROM read:
    Serial.println("drawbar set !!");
    Serial.println(drawbar);
    int drawbar = analogRead(A12);
  }



  motor1.setSpeed(200);
  motor1.step(20, BACKWARD, DOUBLE);//SLACK
  delay(10);
  motor1.release();//disables the H-brige to release coils on motor
  motor2.release(); //allows lower power usage and les heating of driver and motor

  motor2.setSpeed(260);
  motor2.step(0, BACKWARD, DOUBLE);// PEEL BIG LABLE WAS 1000
  delay(100);
  motor1.release();//disables the H-brige to release coils on motor
  motor2.release(); //allows lower power usage and les heating of driver and motor

  // END OF START UP FEED FIRST SHEET AND END OF DEBUGGING VALUES

  // note big label 1s 1500 steps  large web is 300 small web 100


}

// the loop routine runs over and over again forever:
void loop() {

}
7  Using Arduino / Programming Questions / Re: accelstepper functions and control help on: July 08, 2014, 02:31:19 am
i will post my code that i use to use tomorrow

.. if that helps get a better idea of what im trying to do
i would spend days and use up pages on this forum trying to explain what i have tried and what has not worked

iam missing some thing that i can not find in the accelstepper library that would allow me to treat the motor as if it was controlled using the afmotor library    being in one big loop run the motor threw bunch of desired steps and directions running outta paper at the same time as running outta program and looping to the beginning when a new paper is loaded
8  Using Arduino / Programming Questions / accelstepper functions and control help on: July 08, 2014, 02:20:04 am
hello,
 i have a project I'm working on that requires a set of steps to increment a paper threw a roller not much more complicated then that ,except i want to ( increment )

so i place said paper in to roller   call that start postion ( 0 )

then i want to step the motor 100 times , and stop at that position .

all is well at this point . using the example code to do it like this.



Code:

 stepper3.setMaxSpeed(300.0);
    stepper3.setAcceleration(100.0);
    stepper3.moveTo(100);
}

void loop()
{
  
stepper3.run();

}

but now if i want to move it another 100  steps i have to

Code:
   stepper3.moveTo(200);
}

void loop()
{
  
stepper3.run();
}
so i don't under stand how i can rest the number of steps form the last 100 so i can just move the paper forward 100 steps every time with out adding it up.    smiler to how you could  with the motor library !

the problem with the steps adding up is when the paper is at its end and i load the next sheet i will be up to 10,000 steps  then the next sheet will be 20,000 and so on  

so if i could gather some under standing of why im haveing troble doing this then i can move on to my next problem

witch is im trying to run my program the way i had it with the afmotor shield , now using a type of easy driver with a 2 wire setup dirction and pulse ...

my program way ;laid out like this before

( load paper )
1 press button
2 increment paper threw a while loop till sensor found the center of the sheet then wait,
3 press button paper index's half an inch stops and wai ton buttons press,
4 repeat button press as meany times as possible till paper runs out,
5when paper runs out expend the last of the paper threw the rollers, aproxmitly 500 steps
6 then wait for a new sheet
(load new sheet )
repeat !
so im having a hard time figuring out how to make this work with the easy driver & accelstepper library when it was functioning on the afmotor shield and library,


9  Using Arduino / Displays / Re: utft display leaning the code structure on: December 17, 2013, 05:39:33 pm
ahh i missed this some where !

this is a complete success now !
thanks for turning me on to that link between what i could read up on there and finding some thing unexplained in there example code i came up with a simplified working code exactly the way i was hoping it would be !

heres a copy of what i got so far ! 
now it displays exactly the pin read times 10 X 10 for the extra 2 place read out i will require later threw math formulas for pi and leverage  , but this will do ! i believe a can map and create a threshold with this wrapper and get exactly what i want a clean cut screen read out !

thanks again and i hope this helps some one eles out to i did not see it explained and where but i may have missed the construct of this key thing some where   
Quote
  myGLCD.printNumI(sensorValue ,132,90, 0);
     delay(5);
Code:
#include <UTFT.h>
int sensorValue = 0;
// Declare which fonts we will be using
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Uncomment the next line for Arduino 2009/Uno
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

// Uncomment the next line for Arduino Mega
//UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

void setup()
{
    // initialize serial communication at 9600 bits per second:


   
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);
 
   myGLCD.print("FOOT POUNDS", 0, 0);
    myGLCD.setColor(0, 0, 255);
}
void clearField()
{
  myGLCD.setColor(VGA_BLACK);
  myGLCD.fillRect(1,15,318,224);
}

void loop()
{
 
   int sensorValue = analogRead(A7);
   
 sensorValue = (sensorValue*10);
    myGLCD.setFont(SevenSegNumFont);
    myGLCD.setColor(0, 255, 0);
   
 
   
  myGLCD.printNumI(sensorValue ,132,90, 0);
     delay(5);
 
   
   
   



}

10  Using Arduino / Displays / Re: utft display leaning the code structure on: December 17, 2013, 04:40:28 pm
OK so this is an idea i had is kind of does what im looking for but not efficiently if i have to create and if condition for every digit i  posable to get witch is some thing like 2500

Code:
#include <UTFT.h>
int sensorValue = 0;
// Declare which fonts we will be using
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Uncomment the next line for Arduino 2009/Uno
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

// Uncomment the next line for Arduino Mega
//UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

void setup()
{
    // initialize serial communication at 9600 bits per second:

    Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
   
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);
 
    // send an intro:
  Serial.println("send any byte and I'll tell you everything I can about it");
  Serial.println();
 
}
void clearField()
{
  myGLCD.setColor(VGA_BLACK);
  myGLCD.fillRect(1,15,318,224);
}

void loop()
{
 
   int sensorValue = analogRead(A7);

 
    myGLCD.setFont(SevenSegNumFont);
    myGLCD.setColor(0, 255, 0);
   
   if (sensorValue < 1){
       myGLCD.setFont(BigFont);
     myGLCD.print("-MIN-",132,90, 0);
    }
      if (sensorValue > 1){
     myGLCD.print("002",132,90, 0);
    }
      if (sensorValue >20){
     myGLCD.print("021",132,90, 0);
    }
      if (sensorValue > 50){
     myGLCD.print("055",132,90, 0);
    }
      if (sensorValue > 100){
     myGLCD.print("100",132,90, 0);
    }
      if (sensorValue > 200){
     myGLCD.print("200",132,90, 0);
    }
 
      if (sensorValue > 350){
     myGLCD.print("350",132,90, 0);
    }
      if (sensorValue > 460){
     myGLCD.print("460",132,90, 0);
    }
      if (sensorValue > 570){
     myGLCD.print("570",132,90, 0);
    }
      if (sensorValue > 680){
     myGLCD.print("680",132,90, 0);
    }
      if (sensorValue > 790){
     myGLCD.print("790",132,90, 0);
    }
      if (sensorValue > 900){
     myGLCD.print("905",132,90, 0);
    }
   

   
     if (sensorValue > 970){
        myGLCD.setFont(BigFont);

     myGLCD.print("-MAX-",132,90, 0);
 
    }
   
delay(500);


}
11  Using Arduino / Displays / utft display leaning the code structure on: December 17, 2013, 03:36:42 pm
hello i just fired up my first display on an arduino i have only had simple  adruino use needs, up till now !

i have built a pneumatic press witch pushes press pins in for me its a simple thing that the arduino handles  i have a mega doing it i know its over kill so i thought i would add on for fun so i picked up a liner transducer and a air pressure transducer sensor and there some math with pie i can write a value to the serial communication the foot pounds of pressure being applied to the press pin  ,.. why ? 
well just because we can right ?  there not real need to know im just having fun with the project

that being said i picked up a

SainSmart Mega2560 R3 + 3.2" TFT Touch LCD SD Card + TFT Shield Kit For Arduino

and got the libraries up and running and the example demo code working and then played around with the example demo code a bit got some brownie points leaving a repeating text message fort he girl friend before i left for work , so she could find it later on the desk top !

ok so now that i gave some back ground and we all up to speed  here what im trying to do the pin press transducer gives me a value for the foot pounds applied to the pin when it is press i would like to use this display to get a read out installed on the press for every time it is activated it displays the rising pressure number to the tft lcd !

so i was able to modfie the example code to right the girl friend a message but that was a print line (" I LOVE YOU " )

and i need a print line that  is more like this 

Code:
{
    myGLCD.setFont(SevenSegNumFont);
    myGLCD.setColor(0, 255, 0);
 
    myGLCD.print("psi", 200, 0, 90);
      myGLCD.print( SensorValue , 200, 0, 90);}

but it dose not seem to like this can i not display a value that is live being read by and anlog pin live to the display ?


12  Using Arduino / Sensors / Re: 8 pin dip light sensor found ! on: June 13, 2013, 06:44:59 pm
reading ovr how to run this looks simple but what do you do toke this part happen ? "  "
Quote

For proper operation, after meeting the minimum hold time condition, SI must go low before the next rising edge of the clock.
13  Using Arduino / Sensors / Re: 8 pin dip light sensor found ! on: June 13, 2013, 06:26:21 pm
yup found it Texas advance is the brand...http://www.alldatasheet.com/datasheet-pdf/pdf/203005/TAOS/TSL201R-LF.html

TEXAS ADVANCED OPTOELECTRONIC SOLUTIONS - 64 x 1 LINEAR SENSOR ARRAY

pretty sweet..


14  Using Arduino / Sensors / Re: 8 pin dip light sensor found ! on: June 13, 2013, 06:17:38 pm
taos408 second st of number..
15  Using Arduino / Sensors / Re: 8 pin dip light sensor found ! on: June 13, 2013, 06:15:49 pm
tsl201R  first number no name...tho.
Pages: [1] 2 3 ... 8