Show Posts
Pages: 1 ... 72 73 [74] 75 76 ... 225
1096  Using Arduino / Motors, Mechanics, and Power / Re: How to read servo's pulse encoder? on: November 23, 2013, 11:05:37 am
The signal line on a servo is there to control the servo: ie, it's from the uC to servo, not the other way round. A servo doesn't  provide feedback about where it actually turned to.
1097  Using Arduino / Project Guidance / Re: Need help with breadboarding "Example 05" from Banzi's Arduino book on: November 23, 2013, 10:57:45 am
Fantastic! It's working! Thanks!
Also, thanks for the code formatting tip.

You're welcome: glad to help.

Quote
Strange that that line of code was not in the example in the book.

Indeed, but there you go.
1098  Using Arduino / Project Guidance / Re: Need help with breadboarding "Example 05" from Banzi's Arduino book on: November 23, 2013, 10:43:06 am
Quote
When I press and hold the button the LED stays on but doesn't dim.

Judging by the code, it's supposed to get brighter actually, due to this, which increments the variable brightness:

Code:
brightness++;

..... but, that incremented value isn't being used. I think you're missing an analogWrite, something like this:

Code:
if (state == 1 && (millis() - startTime) > 500) {     // if the button is held for more than 500 ms.
    brightness++;                                         // increment brightness by 1
   analogWrite(LED, brightness); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< NEW
    delay(10);                                             // delay to avoid brightness going up too fast

Quote
LED off of pin 13 is constantly on

It's pretty normal

Quote
called for a 270ohm resistor which I didn't have - so I used a 330. Maybe that has something to do with it?

Nope, just makes the current a little less so it's a little dimmer.

EDIT: PLEASE use the # button above the  smiley-sweat to put your code in code tags. Select the part you want as code, then hit that #.

Code:
Code will then look like this
1099  Using Arduino / Programming Questions / Re: Running part of the loop only once on: November 23, 2013, 08:48:52 am
Quote
As a rule of thumb you should declare variables in as small a scope as possible.
Right, that makes sense. Thanks.
1100  Using Arduino / Programming Questions / Re: Running part of the loop only once on: November 23, 2013, 08:40:21 am
majenko, I wrote but didn't post very similar code- you got in first. Question though: I declared my flag as a "normal" boolean not a "static", right at the top of the sketch (above setup()). I think mine would have worked- didn't test it- but  would your approach of "static" inside loop() have any particular advantages?
1101  Community / Exhibition / Gallery / Re: My simplest "Arduino" circuit on: November 23, 2013, 12:05:00 am
Looks simple enough:  even I should manage that  smiley-cool

My local supplier has both the ATTINY85-20PU and ATMEGA328P-PU available. Both are 20MHz versions, is that ok?

Also, one last question Nick if I may: how big a deal is to convert your explanation to the Tiny? Will I be able to figure that out when I look at the pins?
1102  Community / Exhibition / Gallery / Re: My simplest "Arduino" circuit on: November 22, 2013, 11:36:59 pm
Thanks Nick- I'll look at that.

Jim
1103  Community / Exhibition / Gallery / Re: My simplest "Arduino" circuit on: November 22, 2013, 11:25:28 pm
Interesting... I've been wondering about how one puts a project into "production" so to speak, as opposed to development in a Uno.

Nick, where's the best place to read up on that please? Big question of course is how on gets the sketch loaded? Is there an idiot's guide somewhere?
1104  Using Arduino / Motors, Mechanics, and Power / Re: Use digital pins to use a 8-9V Motor ? on: November 22, 2013, 09:55:39 pm
You don't really need a tutorial- look at the "minimal wiring diagram" in the Pictures tab....

You supply the motor power across Vin and Gnd as the pic shows: the control is provided by the AIN1/2 and BIN1/2 lines on the left,  the outputs AOUT1/2 and BOUT1/2 to do what you need to drive the motors.

There are 2 motor channels, A and B. Each has 2 inputs, which are digital lines from your Arduino. If you want speed control, at least one of those will need to be a PWM line. You control direction by changing polarity on those 2 inputs. So if say BIN1 high and BIN2 low is clockwise, the BIN1 low and BIN2 high will be anti-clockwise. Pulse either with PWM and you'll get speed control.

Don't forget to join the grounds together.



1105  Using Arduino / Motors, Mechanics, and Power / Re: Having motor problems only one side works and wont run on usb power help please on: November 22, 2013, 12:26:34 pm
What do you mean "only one side works"?
1106  Using Arduino / Motors, Mechanics, and Power / Re: Use digital pins to use a 8-9V Motor ? on: November 22, 2013, 11:18:27 am
Seeing as you have the ability to choose, rather stay away from the 293 and it's larger cousin the 298: they are older technology and wasteful of energy. Go with newer stuff like the 8833 like that Pololu I linked.

Have fun....
1107  Using Arduino / Programming Questions / Re: Multi coin acceptor and button on: November 22, 2013, 05:29:34 am
I didn't suggest to use >5.... I asked why you were using >5 when you had said it only counted 5 pulses.
1108  Using Arduino / Programming Questions / Re: Multi coin acceptor and button on: November 22, 2013, 02:23:24 am
Do you mean it's getting to that block (as indicated by "LED ON") and not illuminating, or is it not getting there in the first place?

Well you say you read 5 pulses, but you test for more than 5....

Code:
if (highCounter > 5)  //<<<<<<<<<<<<<<<<<<<<<<<< 5? or more than 5?
    {
      lcd.setCursor(0,3);
      lcd.print("LED ON");      // is it getting this far?
      digitalWrite(ledPin, HIGH);
      delay(5000);
      digitalWrite(ledPin, LOW);
      highCounter = 0;
    }
1109  Using Arduino / General Electronics / Re: My 6V servo controlled with Arduino on: November 21, 2013, 10:24:30 pm
That connection pic of the kat which zooms should be lodged somewhere in the header of every forum page for everyone to see all the time. It is probably the single-most-used answer to servo-related forum questions! I have taken the liberty of saving it and will use it, with attribution to zk, in my answers too, if @zoomkat you have no objection to that.

1110  Using Arduino / General Electronics / Re: total newbie first breadboard on: November 21, 2013, 10:03:25 pm
Quote
sounds like you have a short-circuit somewhere in your wires

Yep that's what I was thinking, hence my suggestion for a photo. Must say, I find those 4-pin square push-buttons confusing, might be something to do with having that sucker mis-wired. This pic shows that the opposite pins are always connected, and pins on the same side are switched.
Pages: 1 ... 72 73 [74] 75 76 ... 225