Show Posts
Pages: 1 ... 36 37 [38] 39 40 ... 96
556  Using Arduino / Project Guidance / Re: How to control direction of stepper motor using micro switches on: February 24, 2014, 11:55:37 am
Post your code, using code tags (the # button above the input box).
557  Using Arduino / Programming Questions / Re: while and millis on: February 22, 2014, 10:58:37 pm
Although it won't solve your problem, note that:
Code:
if (buttonState ==LOW)
         {
           digitalWrite(ledPin,HIGH);
         }
         else{
           digitalWrite(ledPin,LOW);
         }
condenses to:
Code:
digitalWrite(ledPin,!digitalRead(buttonPin));
558  Using Arduino / Programming Questions / Re: abort for-loop at any time on: February 22, 2014, 10:41:26 pm
Another way to do it is to make the loop variable go out of range.
Code:
for (i =0;i<=100;i++){
if (you want to exit the loop) i = 101;}
It won't break out immediately, only at the end of the for loop (closing curly bracket), but before the next itteration.
559  Using Arduino / Programming Questions / Re: Driving 8 Servos with For Loop Reed Switch on: February 22, 2014, 12:49:48 am
What PeterH said and also look up 'Finite State Machine'.
560  Using Arduino / Project Guidance / Re: Measuring length of block on: February 22, 2014, 12:35:16 am
Does it know which way the blocks are orientated?  If length is the only variable, end on, all the blocks will look to be the same size.
561  Community / Bar Sport / Re: Calls "from windows" about "online hackers inside your computer". on: February 20, 2014, 11:28:06 pm
It is a scam that has been used in the UK for a few years now.
They ask you to type something in and you tell them what it is.
They say you have got a virus which is serious but they can fix it for a fee.
You pay them £150, and they say they do something and then they say it is clear. They promise that the fee will cover future work.
You are then rung up every month or so and they get you to pay increasingly large amounts of money.
One woman on a consumer program is reported to have paid over £12,000.
I get about three of these calls a week. I just say I run a Mac (which I do) and they hang up.
I don't get that many. The last one was about 6 months ago. I asked them which computer they're talking about, as I own several. I then asked them what IP address it's on, which ISP I use, whether it's running XP, 7 or 8.1 and how the virus was not detected by my antivirus program. After a couple of minutes of floundering, because they didn't know the answers, they hung up.
562  Using Arduino / Programming Questions / Re: Stepper with limit switches and push button to start on: February 20, 2014, 10:23:26 pm
For example, currently I dont know how to pause/stop my stepper routine functions with the Stop Button or Limit Switches.
This is what I am asking for advice on smiley

Take the functions below - how would you pause it with a push button during the routine, or even stop it without using the software reset function (which Robin suggests is a bad idea) - but works smiley-wink?
What currently happens is the routine10(); is called by the pot, stepper is stopped and starts when I hit the push button  checkSSBTN();
Once you have hit that button and called  stepper.runToPosition(); you CAN'T stop it, except by removing the power or a reset. Once you've pulled the trigger, can you get the bullet back in the gun?
The only way to do it is stepwise. Pseudocode:
Code:
While (limit switches and button not closed and count < required number of steps){
step one step;
delay(to slow speed, as set by pot);
count++;
}
That way, you're checking for a button push and a limit switch closing after each step. Count will tell you how far along it is, if it's stopped in the middle.
563  Using Arduino / Project Guidance / Re: Dirty Power Issue? on: February 20, 2014, 09:10:32 pm
What is the max resistance of the pot?
What is the resistance (hot and cold) of the thermistor?
564  Using Arduino / Project Guidance / Re: Beginner. on: February 20, 2014, 08:58:42 pm
Here is another starter kit.
http://www.pololu.com/product/2187
Adafruit also has some great tutorials.
http://learn.adafruit.com
I'll add the starter kit I got from Sparkfunhttp:/sparkfun.com is a good start.
565  Using Arduino / Project Guidance / Re: Measuring length of block on: February 20, 2014, 08:44:44 pm
Paint the blocks with matt paint, either black, white or grey, according to their length. Use the reflectivity of the paint to determine their length.
566  Using Arduino / Project Guidance / Re: sturdy attachments to arduino ports. on: February 20, 2014, 08:33:16 pm
A screw shield.
567  Using Arduino / Programming Questions / Re: Stepper with limit switches and push button to start on: February 19, 2014, 05:37:09 pm
Thanks Robin, yes I understand resetting the Arduino is not the best way to go about things.
Specifically if I intend to keep track of steps right?

At this point I am not going to bother keeping track of steps, it is a bit beyond me.
I admit I have swayed from Henry's suggestion, I am just trying to keep this is the realm of my understanding and skill level with coding this.
If I knew how to code this in the fashion of yours and Henry's logic, I would absolutely do so.

I'll get better I promise smiley
Your approach of just stringing a load of functions together won't get you any better, despite your promises. You have to first work out a logical sequence of what you want to happen and when. You can't ignore that step, even on the simplest of programs.

Imagine the task of boiling an egg. Here are the steps you need.
Find egg
Find pan
Find source of heat
Find source of water
Find dessert spoon
Find teaspoon
Find egg cup
Find plate.
Find egg timer or timepiece (clock, watch, mobile phone, etc).
Put water in pan
Place pan over heatsource
Light/turn on heatsource
Wait until water boils
Place egg on dessert spoon and lower gently into boiling water.
Start egg timer or note start time on timepiece.
Keep watching timepiece/egg timer to see if 3 minutes has elapsed.
When 3 minutes has elapsed
Turn off heat source
Remove pan from heat source
Use dessert spoon to remove egg from the water
Place egg in egg cup
Place egg cup and teaspoon on plate
Serve

If you can do that for your program you're half way to having your program written.
568  Using Arduino / Programming Questions / Re: Reversing dc motor with momentary press of microswitches on: February 19, 2014, 04:28:16 pm
How have you got your limit switches connected? When closed do they pull the pin low or high?
It would be much clearer to us (and you in 6 months time) if you labeled your limit switch pins 'pinLimitLeft' and 'pinLimitRight' and your movement direction as left and right or Left and !Left (= NOT Left).
If the right limit switch is closed you want your motor to next go to the left and vice versa. It would be a good idea to stop the motor for a short while at the end stop to avoid putting a strain on the motor when it goes from full speed in one direction to full speed in the other.
569  Using Arduino / Project Guidance / Re: "Sshhh" button. on: February 19, 2014, 01:55:59 pm
You want to calm the baby?
570  Using Arduino / Project Guidance / Re: Hi! Can please help me with my colour sorting code(Servos arm)? on: February 19, 2014, 01:33:41 pm
How many different colour balls are you using?
Pages: 1 ... 36 37 [38] 39 40 ... 96