Pittsburgh, PA, USA
Offline
Faraday Member
Karma: 31
Posts: 2931
I only know some basic electricity....
|
 |
« Reply #30 on: February 08, 2012, 07:15:31 am » |
Is the pot output connected to A0, maybe through a 1K resistor? And in that connect, a 10k or so resistor to ground as well? If you don't have that resistor to ground then you will always get saturated reads and wonder what's wrong.
Then analog read A0 and you have your turn pot sensed.
|
|
|
|
|
Logged
|
Examples can be found at Learning in the Main Site and at the Playground
|
|
|
|
florida
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #31 on: February 08, 2012, 06:46:42 pm » |
the delay got mad and said it expected a ; . maybe its the pot i have one wire to a ground middle wire to the a0 pin one wire to a 5 volt spot the green light lights up when i move it one way
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25508
Solder is electric glue
|
 |
« Reply #32 on: February 09, 2012, 03:54:57 am » |
All statements in C need to end in a semicolon ; What is the green light? Is it the direction?
|
|
|
|
|
Logged
|
|
|
|
|
Pittsburgh, PA, USA
Offline
Faraday Member
Karma: 31
Posts: 2931
I only know some basic electricity....
|
 |
« Reply #33 on: February 09, 2012, 08:07:40 pm » |
the delay got mad and said it expected a ; . maybe its the pot i have one wire to a ground middle wire to the a0 pin one wire to a 5 volt spot the green light lights up when i move it one way
You want to attach to the middle wire, another wire with 10+k resistor to ground. You want some resistors in there to limit current flow. One pin can handle 40 mA but you don't want to push the pins like that, 20 mA per pin is a nice 'limit' but you don't need that much current. I have input pins being fed 0 - 5V through 2.2k resistors, 2.27 mA, works fine. Those same input pins connect to ground through 22k resistors, that's where the 2.27 mA goes. Maybe I should try 4.7k instead of 2.2k to use 1.06 mA.
|
|
|
|
|
Logged
|
Examples can be found at Learning in the Main Site and at the Playground
|
|
|
|
florida
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #34 on: April 01, 2012, 06:21:55 pm » |
ok i am back on this project life and frustration got in the way. now i am ready to try again. i also need to start from the point of what resistors do i need to install for the pot to work. i would like to have the pot control a stepper motor to move 200 steps forward and 200 backward. if pot stops so does the motor. thanks for helping everyone
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25508
Solder is electric glue
|
 |
« Reply #35 on: April 01, 2012, 10:11:36 pm » |
OK so, as it has been a time and there has been several software versions used, can you post a schematic of what you have wired up along with the code you are trying to use.
|
|
|
|
|
Logged
|
|
|
|
|
florida
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #36 on: April 14, 2012, 05:02:39 pm » |
been busy thanks for patients in advance i am using the simple program from before a polou a4988 driver and a 3 prong pot from radio shack i just bought a volt meter my power supply has an output of 24v and 6.5a i have the driver in the easiest setting with 1a and 2a connected and 1b and 2b connected no microstepping.i just need the motor to follow what the pot does 200 steps one way 200 steps the other
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25508
Solder is electric glue
|
 |
« Reply #37 on: April 14, 2012, 05:24:12 pm » |
OK so, as it has been a time and there has been several software versions used, can you post a schematic of what you have wired up along with the code you are trying to use.
|
|
|
|
|
Logged
|
|
|
|
|
florida
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #38 on: April 17, 2012, 08:08:51 pm » |
i attached a quick pencil sketch if it comes out to small i will make a bigger one. i hope someone can help i feel it is so simple to make this work but i just dont get it
|
|
|
|
|
Logged
|
|
|
|
|
florida
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #39 on: April 18, 2012, 08:16:08 pm » |
maybe we can try this code again
// change this to the number of steps on your motor #define dirPin 10 #define stepPin 11
// the previous reading from the analog input int previous = 0; int val =0; int dir = 0; // direction of movement int steps = 0; // number of steps to take
void setup() { pinMode(stepPin, OUTPUT); digitalWrite(stepPin, LOW); pinMode(dirPin, OUTPUT); }
void loop() { // get the sensor value val = analogRead(0);
// move a number of steps equal to the change in the // sensor reading steps = (val - previous); if(steps > 0){ dir = 0; } else { dir = 1; steps = -steps; } digitalWrite(dirPin, dir); // set up the direction for(int i = 0; i< steps; i++){ digitalWrite(stepPin, HIGH); // pulse the step pin digitalWrite(stepPin, LOW); } // remember the previous value of the sensor previous = val; }
|
|
|
|
|
Logged
|
|
|
|
|
Southern California
Offline
Sr. Member
Karma: 5
Posts: 466
I like blinky lights
|
 |
« Reply #40 on: April 19, 2012, 12:13:47 am » |
Between these two lines: digitalWrite(stepPin, HIGH); // pulse the step pin digitalWrite(stepPin, LOW);
add the delay: digitalWrite(stepPin, HIGH); // pulse the step pin delay(100); digitalWrite(stepPin, LOW);
You will probably be able to use lower #s than 100...
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25508
Solder is electric glue
|
 |
« Reply #41 on: April 19, 2012, 08:26:21 am » |
i attached a quick pencil sketch But it is not a schematic is it, it does not show the circuit you are using.
|
|
|
|
|
Logged
|
|
|
|
|
florida
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #42 on: April 19, 2012, 09:06:24 pm » |
im not sure what you are talking about do you want a picture of the way i have it set up?
|
|
|
|
|
Logged
|
|
|
|
|
|
|
florida
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #44 on: April 24, 2012, 06:01:00 pm » |
is this right? and thanks for helping. it means alot
|
|
|
|
|
Logged
|
|
|
|
|
|