Show Posts
Pages: 1 2 3 [4] 5 6 ... 86
46  Using Arduino / Programming Questions / Re: How to poll an analog pin until it is "High" on: May 13, 2014, 01:33:19 pm
Hint as to why
Code:
analogWrite (pin[k], analogRead (inputPin [k]) / 4);
is flawed:
==> Why you may need to use the map() function.

BTW - editing the top post makes it VERY hard for others to follow the thread as the earlier version of your question has disappeard, but the answers still stand in the thread.  I do not get the connection between making a LED intensity follow an analog input and the triangle wave fader.
47  Community / Exhibition / Gallery / Re: Blink without "delay()" - stepping up. on: May 12, 2014, 01:15:07 am
Code:
led1State = !led1State;//Invert Led1State, HIGH becomes LOW and LOW becomes HIGH.
Strictly speaking that is bad - HIGH / LOW are not the same as true / false. They may map to it, but it is a different "type".

I'd also add an explanation that, although this code only blinks LEDs, the principle can be use to time anything.
Oh yes, indeed. But, I have found through reading "a few" examples and newbie question that somehow for them going from a LED example to something else is too abstract/large a leap. Many want to see an example of one LED + one stepper or two DC motors or one button scan + two LEDs or any other specific combination.
48  Community / Bar Sport / Re: ship in a bottle 3D printer on: May 09, 2014, 03:10:04 pm
Good idea - but the laser beam will be distorted by the glass bottle. Still, it is a predictable distortion, also one that could be measured by first printing a grid (whioch you destroy and remove) and the software does the anti-distortion. I am skimming over focusiing problems.

Unless the beam comes in like the plastic prong drawn by Boffin1.

49  Community / Bar Sport / Re: Post your code on: May 09, 2014, 03:03:10 pm
Oh, how happy I am I managed to see this post. (I have times where life is to busy to read The Forum, and there is too much to catch up)

And by the 3rd line in the OP my mind was humming "Let it Be". Why, one wonders? There are not that many clues by then. Ah well, all the more the enjoyment og GMs vocal interpretation.

Defenitly nice - the lyrics. The song - well, we do not need to rate that. It is c l a s s i c 
50  Using Arduino / Project Guidance / Re: 2 Stepper Motors with 300 to 600 rpm on: May 07, 2014, 07:23:54 am
... And it will give me higher speed and smaller torque..
Will the motor turn if the supply to it is only 0.5A?
The lower amperage does not in any way imply that you get higher speed. I am saying that you can get enough speed even though you limit your current, and the formula-webpage implied that you could not reach full speed if you wanted full current.

The motor will turn with maybe only 100mA. I do not know, but for many steppers "just" turning you do not need a lot of mA. (I cant be bothered right now to read the fineprint in the spec sheet)

If you buy the chip, have you got knowledge/equipment to do the circuit board? I am worried as the discussion so far has shown that your electronics knowledge is not that great. (Nor is mine that great, really, but enough for the projects that I do) I would by something like http://www.pololu.com/product/2133 - then it is much simpler. Also worry about the heat from the chip - it needs plenty air or a little heatsink.
51  Using Arduino / Project Guidance / Re: 2 Stepper Motors with 300 to 600 rpm on: May 07, 2014, 02:29:05 am
You only need all those Amperes if your motors need maximum torque, You have almost no load. (Well, I do not really know. Presumably there is some load as the vibrations you want to induce require energy, ie there is some transfer of mechanical energy from the turning eccentric).

Remember, you adjust the circuit of the DRV8825 to limit the current. (Are you buying the chip, or a board with supporting electronics?) For your experiment you want to supply as little current as possible - this will reduce the vibrations the motor itself generates.

I played a bit with the calculator link you supplied. Notice that as you decrease the current the calculated max speed increases. The calculation is just modelling a "simple" coil. It assumes you must get to Imax. If your speed is higher, then it simply does not get to Imax,, but the motor still turns at the higher speed. This is what the diagrams of the motor manufacture show - as speed increases the torque drops; the torque is proportional to the current and at high speed the current in the coil does not reach max value before it is turned off - that is what inductance does, so to speak. All sort of effects also play in, but the manufacture shows an actual measured curve.
52  Using Arduino / LEDs and Multiplexing / Re: 3 buttons for 3 LEDS - SOLVED on: May 04, 2014, 10:40:00 am
Well, if it works then everybody is happy. smiley

If it works and you do not know why it suddenly worked, then you may suddenly have a surprise. (It stops working)

Some possible faults have been mentioned. In addition I can suggest you may not have the wiring you think you have - which is why the troubles started with the 3rd LED/button. You may have an errenous wiring one that is wrong but happens to work for the wrong reasons.
53  Using Arduino / LEDs and Multiplexing / Re: Lcd shield for arduino? how to use it? on: May 03, 2014, 04:04:29 pm
Look at this --> section 7 about using code tags. Then stop begging for help. It is undignified.

Does the code work with your current setup? Does the Serial.print output give the correct (or close enough) result?

Removing the Servo code is trivial - unless I misunderstood the question - just delete those code lines that use it.
 
So all you want to do is to replace Serial.print with LCD.print ? ... have you looked at the example sketch File->Examples-LiquidCrystal->HelloWorld ?

We all were "newbies" at some point in time. (I noticed your earlier post) If this project is "too much", then try someting simpler first. As you learn by experimenting you will find how to do this.
54  Using Arduino / LEDs and Multiplexing / Re: 3 buttons for 3 LEDS on: May 03, 2014, 03:43:20 pm
There is nothing in you code that is "Limited by the UNO hardware".

From bitter experience I know that cut-n-pasted code-snippets and then changing variable names (your identical code sections that use ...RED, GRN and ...GRN1) is prone to forgetting or mixing up a name. I've looked and didnt find one, but these are hard to see.

PaulRB has asked about the pulldown resistor - this assumes the switch pulls the line high.

There is the possibililty that pin4 is "bad". If you played a lot with your UNO you may have "stressed" the pin. Try using pin 5 instead of 4.

55  Using Arduino / Programming Questions / Re: Can the Arduino do two things at one time? on: May 03, 2014, 03:00:34 pm
Going back to the question in the subject: "Can the Arduino do two things at one time?" the answer is NO.

BUT - by switching between two tasks often enough it will appear to do two (or three, four...) things at the same time.

This is why you see so many posts talk about the "Blink without delay" example, because neither of your two tasks may block - that is, sit in a loop doing something that takes time. They must do such tasks a small step at a time, remember how far they got, and when the loop() gets round to the again, take the next tiny step.

The trick of the "Blink without delay" technique is that the large "delay()" is actually just taken off in small bites by just executing millis() to look at the clock. See if http://playground.arduino.cc/Code/AvoidDelay helps explaining this.

Now, back to the program. I am sorry I have not studied your code. I have just looked if it had the classical error - using delay(). Yep.

"delay()" and "two things at once" are mutually exclusive.
56  Using Arduino / LEDs and Multiplexing / Re: Multiplication in Trinary on: May 03, 2014, 06:30:58 am
That sounds like an interesting project! What are you going to use it for? Pardon my suspicious nature, but it sounds so very much like an exercise given in school/college. I dont do other persons homework.

If it is because it is a nice challenge to programming, then I suggest you start by writing a sketch that can read a button and send a single character to Serial. What you'll find is the first minor hurdle, "switch debounce". When you fix that you can expand the program to count the button 1 pushes and and the answer on Serial when 2nd button is pushed.

If there is a particular issue that dumbfounds you, then post the code you've tried so far and explain what you want it to do, and what it actually does.

Lastly . Where does the "trinary" come in? A LED is a "binary" device (either On or off). Or are your "LEDs" actually digit display (7-seg) and you are displaying a number in trinary (i.e. using digits 0, 1 and 2 only)?
Edit: The OP edited his question explaining the trenary. So my question here is thus superflous.( I dont like edits to top ost that make my answer/help/clarifications seem idiotic.)
57  Using Arduino / LEDs and Multiplexing / Re: Pulsing an led strip on: May 01, 2014, 05:55:46 am
How much have you got working?

Have a look at the Example -> Analog -> Fading. Replace the analogWrite with setPixelColor(). Yes this is a triangular fade-in/out. To make it look "sine wave like" you need to experiment as LED fades never seem "liniear" (twice the number is not twice the brihgtness) - but first get this working.
58  Community / Exhibition / Gallery / Re: Blink without "delay()" - stepping up. on: April 30, 2014, 03:17:42 pm
This is a general problem with "forums" with innumerable "threads" streaming away and no fixed "root" structure.  A Wiki (in addition) would seem more appropriate.
That is what the Playground is - a wiki. Top menubar of the standard Ardino webpage, Learning - Playground. In the left menu selection try "Tutorials", and therein "Protothreading, Timing & Millis", and in that section "How and Why to avoid delay".

(editing post - forgot to add )  I think it is fine to place it here. But before placing it here as a finished example, you could perhaps have let the discussion and suggestions run in Programming.  Your example has at least two errors as others have pointed out.
59  Topics / Robotics / Re: i want to use servos without using delay, help me please on: April 29, 2014, 02:20:29 pm
i don't why it doesn't work
What does not work?

You MUST describe what you EXPECT to happen, and what ACTUALLY happened. Then others will know what error it is you are having. Your description does not even say if it is a compiler error you are getting, or if something is smoking.
60  Community / Exhibition / Gallery / Re: Blink without "delay()" - stepping up. on: April 29, 2014, 02:05:36 pm
Do correct me/ shout me down if this is not the most appropriate place, or if this has so blatantly been done before,
I am far too polite to shout smiley

Anyhow: http://arduino.cc/forum/index.php/topic,76140.html Unfortunatly owing to a strange misunderstanding this is not a sticky, so people who answer have to remember to have their own cut-n-paste bookmark file to refer to it. That example was the result of rather lengthy discussion amongst regular contributors where just about every line was revised to be as correct and educational as possible. http://forum.arduino.cc/index.php?topic=74861.msg56413

There have - of course - been others that have tried to do explain this "how to have several things at once". Many times. There are libraries with "timer classes" so that it hides the complexity (though how using such a library should be easier than remembering 3 lines of code... ? Ah well, we are all different) I've seen at least two attempts to make a new "framework" where loop() has been taken away and people just write sections of code which then get called at the right intervalls.

Despite all that, there will be people that will ask "The Question" - again and again. Partly beacuse it is too difficult to find the refereneces, partly because it presumes they read, think and understand the issue before willy-nilly cut-n-paste code.
Pages: 1 2 3 [4] 5 6 ... 86