Show Posts
Pages: 1 ... 40 41 [42] 43 44 ... 266
616  Using Arduino / Motors, Mechanics, and Power / Re: Would this power supply run 2 nema 17 motor? on: May 22, 2014, 04:37:11 am
The point here is surely, as CR points out, that the electrical characteristics of the OP's motors are not known to us.

The NEMA specs merely give the physical size of the unit and specify mounting hole details; they are silent on the electrical aspects. That's pretty clear from CR's link, where a vendor shows various NEMA17s of different torque and therefore presumably of differing voltage and current.
617  Using Arduino / Programming Questions / Re: for loops aren't running one at a time. on: May 22, 2014, 04:09:44 am

for(; ; ; )


You mean:

Code:
for(;;);
618  Using Arduino / Programming Questions / Re: for loops aren't running one at a time. on: May 22, 2014, 03:44:30 am
Thanks JimboZA, that helped a lot with the understanding.

I merely wrote down what i observed the stepper motors doing just btw ^^

You're welcome.

If the stepper driven by the top "for" isn't doing what you expect (ie, not moving) that might be a wiring fault, or the stepper may be broken, and that would lead you to think the top "for" wasn't activating.

Apart from the valuable debug prints, the suggestion above somewhere to have an led turn on in the top "for" and off in the bottom one would also have shown both were active. (Or a red one on in only the top "for" and a green one on only in the other one, might be a more positive way of showing where the path through the code has gone.)
619  Using Arduino / Project Guidance / Re: Arduino code for fuzzy logic controller on: May 22, 2014, 02:58:15 am
Fuzzy logic is a marketing term. Technically, it is called "an algorithm". It uses '0' bits and '1' bits with no fuzziness in between.

The fuzziness in fuzzy logic has nothing to do with fuzz between 0s and 1s. It's to do with set membership. In typical crisp logic, Venn diagram stuff, an element is either "in" a set or "not in" a set; something's either "hot" or "cold", or "tall" or "short". In fuzzy logic, an element can be a member of both the "tall" and "short" sets.

The output is never fuzzy, in the sense that a set of inputs will give the same output each time, unless the algorithm or its parameters have changed in the meantime.
620  Topics / Robotics / Re: Arduino robot questions on: May 22, 2014, 02:16:26 am
Quote
   the Arduino Robot:

I don't know what Arduino Robot your talking about . I think there's hundreds of arduino robots. Post a link to it.


While it's true to say that there are hundreds of robots built on Arduinos, afaik there's only one Arduino Robot, as in Arduino branded, and that's this guy here. That's probably what the OP's talking about.
621  Using Arduino / Programming Questions / Re: Programing a range of values from an analog pin to execute a certain function on: May 22, 2014, 01:47:54 am

to execute a certain function.

The idea is there are several programs I want to use the sliding potentiometer to select.


Those aren't the same thing. Arduinos only run one program, but yes, you can have loads of functions.

So all you need is to have an "if" statement to check the values, and use the && to test  ranges. Say you have already read the pin into a variable called "myPotVal", then you do this:

Code:
if (myPotVal > 0 && myPotVal <65)
{
  // do some stuff here
  // this could be either in-line code here, or a call to a function
}
else if (myPotVal > 64 && myPotVal <129)
{
  // do some other stuff here
  // this could be either in-line code here, or a call to a different function
}
622  Using Arduino / Programming Questions / Re: for loops aren't running one at a time. on: May 22, 2014, 01:01:40 am
Your code DOES run through both "fors", there is no doubt about that. But it WILL be looping thru loop() again and again, since that's exactly what loop() does. If you only want it to happen once, move it all into setup().

I took your code and added debug prints as suggested in an earlier post. I reduced the 6400 and 3200 to 6 and 3 for debug purposes. I put a while(1) at the bottom just to "stop"  the code and prevent it returning to the top of loop() to let me get only one debug screen full. Here's my debug prints which show without any doubt that both "fors" are being activated with your exact code.

Code:
In setup
At top of loop
In 1st for
In 1st for
In 1st for
In 1st for
In 1st for
In 1st for
In 1st for
between the fors
In 2nd for
In 2nd for
In 2nd for
In 2nd for
at bottom of loop

Here's your code intact except for debug prints and the pausing "while" at the bottom:

Code:
int Dir = 2;
int Step = 3;
int x = 0;

void setup() {
  pinMode(Dir,OUTPUT);
  pinMode(Step,OUTPUT);
digitalWrite(Dir, LOW);
digitalWrite(Step, LOW);
Serial.begin(9600);  //new
Serial.println("In setup"); //new
}

void loop()
{
  Serial.println("At top of loop"); //new
  for (x; x<=6; x++)  //changed to 6 for debugging
  {  
    Serial.println("In 1st for"); //new
    digitalWrite(Step, HIGH);
    delayMicroseconds(50);        
    digitalWrite(Step, LOW);
    delayMicroseconds(50);
  }
Serial.println("between the fors"); //new
    delay(1000);
    x=0;

  for (x; x<=3; x++)   //changed to 3 for debug
  {  
    Serial.println("In 2nd for"); //new
    digitalWrite(Step, HIGH);
    delayMicroseconds(100);        
    digitalWrite(Step, LOW);
    delayMicroseconds(100);
  }
 x=0;
 Serial.println("at bottom of loop"); //new
 
 while(1){}; //to prevent it looping to limit debug screen
}

EDIT... changed the code slightly to print x as well, which may be useful to see what values are used at the ends of the "for"..

Code:
In setup
At top of loop
In 1st for x= 0
In 1st for x= 1
In 1st for x= 2
In 1st for x= 3
In 1st for x= 4
In 1st for x= 5
In 1st for x= 6
between the fors
In 2nd for x= 0
In 2nd for x= 1
In 2nd for x= 2
In 2nd for x= 3
at bottom of loop
623  Topics / Robotics / Re: uArmⅠ:An open source robot arm on: March 26, 2014, 08:23:20 am
(I know I didn't post them anywhere, and I trust that Jimbo didn't, either)

I said in an earlier post (Reply #45) that they weren't mine to distribute, when someone asked me to forward them, so No.

Haven't gotten any progress report from  JimboZA, either.

Progress report: I have stopped all Arduino / robotics activity.

624  Using Arduino / Programming Questions / Re: Coding an XOR on: February 26, 2014, 03:36:20 am
Never mind. Sorry I asked now.

My question is answered.

Btw, not once did I use the word "problem".

Thanks everyone.
625  Using Arduino / Programming Questions / Re: Stuck in a simple function programming on: February 26, 2014, 03:10:14 am
The Moral of the Story.... post all code not just the part where it seems the problem might be.
626  Using Arduino / General Electronics / Re: Power to Yun - Can I split a 12V 5A to only send 5v to yun? on: February 26, 2014, 02:53:48 am
Quick and wasteful way would be a 7805 to step the 12 to 5, but better is to use something like this. EDIT... but look at how much current you need too. Also that 2120 is adjustable which is why I bought it- have a dig around at Pololu.
627  Using Arduino / Programming Questions / Re: Stuck in a simple function programming on: February 26, 2014, 02:51:21 am
The problem is almost certainly caused by the fact that the function is defined within another one. 

Yep that's sort of what I was thinking: OP might have put this function just above the closing } of loop() for example....
628  Using Arduino / Programming Questions / Re: Stuck in a simple function programming on: February 26, 2014, 02:34:01 am
Post the few lines above it..... I'm guessing a previous line wasn't terminated or something.
629  Using Arduino / General Electronics / Re: Why did they put this resistor here? on: February 26, 2014, 01:10:00 am
In this application, yes.

I'm having a good day: it's only 0815 here and I've learned two things already. By hometime I'm going to be bursting with new knowledge.
630  Using Arduino / General Electronics / Re: Why did they put this resistor here? on: February 26, 2014, 01:06:23 am
Oooo, so did I have that back-asswards? It's not to limit the current into the transistor, it's to limit the current out of the uC?
Pages: 1 ... 40 41 [42] 43 44 ... 266