Show Posts
Pages: 1 ... 48 49 [50] 51 52
736  Using Arduino / Programming Questions / Re: implementing a "soft reset" ISR / delay inside isr on: February 08, 2011, 10:42:48 am
Seems to me the root of your troubles is the use of delay().  Instead of trying to work around the problem, why not just fix the root problem, ie use millis() instead of delay().  In my book, that is a far cleaner solution than trying to resort to a stack manipulating ISR() to abort a delay().
737  Using Arduino / Motors, Mechanics, and Power / Re: Step Motor Library on: February 08, 2011, 09:52:19 am

It looks like that Gecko motor driver handles all the control logic for you. IOW, you don't need a step motor library to interface with that motor driver.  Just tie two Arduino outputs to the direction and step inputs on the motor driver.  Set the 'direction' output to the direction you want the motor to turn, and pulse the step output to turn the stepper motor in that direction (one step per pulse).

I do not believe the Stepper library works with a direction/step arrangement.  The motor pins refer to the pins driving the coils themselves.  Direction is determined by specifying a positive or negative number of steps when you call the step() method.
738  Using Arduino / Motors, Mechanics, and Power / Re: PID Example 1 on: February 08, 2011, 09:14:45 am
analogWrite() works with the PWM pins, so pin 3 refers to digital pin 3, not analog pin 3.  The analog inputs are input only (as outputs they are digital, but without PWM capabilities)

And that sample is from the PIDLibrary in the playground here:
739  Using Arduino / Programming Questions / Re: Timer overflow interrtups - how ? on: February 07, 2011, 03:26:17 pm
Tutorial on AVR timers.
740  Using Arduino / Programming Questions / Re: ADDING SINGLE PUSH BUTTON TO EXISTING CODE USING BRICK SHIELD V4 HELP PLEASe on: February 04, 2011, 09:44:07 pm
Sorry, I had one incorrect line in my sample code for you.  Change the following line:

active != active;


active = !active;

That's what I get when I rush something and just compile it without running it.
741  Using Arduino / Motors, Mechanics, and Power / Re: Motorshield? on: February 03, 2011, 05:00:25 pm
The tamiya twin gearbox motors are only rated for 1.5-3.0 volts.  People have run them at 5 volts, but their life can be severely shortened by doing so.  They just aren't built to handle more than 3 volts.

That being said, that gearbox is well suited to small robotic rovers.  Just don't overdrive the motors.  I burned out one of mine with about half an hour of runtime at 5 volts.  (That was half an hour of intermittent usage over a period of a few hours as I was writing and debugging my control code).

I then replaced both motors with a pair of these: and they've been running like a champ ever since.
742  Using Arduino / Programming Questions / Re: ADDING SINGLE PUSH BUTTON TO EXISTING CODE USING BRICK SHIELD V4 HELP PLEASe on: February 03, 2011, 02:48:13 pm
Almost, but not quite.  My last instruction was a bit misleading though, so that's my fault.

I really meant to say fill in the two blocks of the second if statement.  The first if is just toggling the active state, and there shouldn't be any other code in there.  The second if statement has two blocks (a block being a section of code surrounded by { and }).  One will execute while active = true, the other will execute while active = false.

If you don't want anything happeneing while active = false, then leave that section blank.

Delete the code you added in the first if() and see if that does what you want.
743  Using Arduino / Programming Questions / Re: ADDING SINGLE PUSH BUTTON TO EXISTING CODE USING BRICK SHIELD V4 HELP PLEASe on: February 03, 2011, 11:34:38 am
It appears that mini push button board has some hardware debounce (there's a resistor and a cap on the board, and I think it's safe to assume that is what they're there for).

If I am understanding correctly, you want to toggle your servo/led activity on and off with separate activations of the button.

boolean active = false;
boolean lastState = LOW;
boolean currentState = LOW;
byte buttonPin = A0;

void setup(){

void loop(){
  currentState = digitalRead(buttonPin);
  //When lastState is LOW and currentState is HIGH, we have detected a rising edge transition
  //ie the input has just gone high.  This is when we toggle are active boolean
  if(lastState == LOW && currentState == HIGH){
    //toggle active state
    active != active;
  lastState = currentState;
    //Perform actions when active = true;
    //Perform actions when active = false;

I was unclear exactly what you wanted to happen in those two states, but simply fill the two if blocks with the code you wish to have executed for each state.
744  Using Arduino / Project Guidance / Re: DC Motor Indirectly Powered by a Solar Panel on: February 03, 2011, 09:45:04 am
If we crunch a few numbers, we can easily get an idea of how long the train can be run via the solar panels.

12V solar panels at 25mA = 300 mW of power.

12V motors drawing 2A = 24 watts of power (or 24000 mW).

At 100% efficiency (unrealistic, but just to get some ballpark numbers), for every minute the train runs, the solar panels will need more than 80 minutes to recharge.  If we factor in the inefficiencies of the system, you're looking at increasing that time by upwards of 50%.
745  Using Arduino / Project Guidance / Re: Counting Ants on: February 03, 2011, 09:13:26 am
but I don't know how to do this 60 times, or otherwise keep track of when to log the numbers, when the minute is up. How does one use interrupts? What's the digital--> blink you referred to?

Each time you add to the average, increment a separate counter variable as well.  When the counter = 60, log and reset.  Something like:

  temperature += (voltage - 0.5) * 100 / 60;
  tempCounter++; //this can be defined as a byte (but if you want to increment up to values above 255, you'll need to use a larger variable
  if(tempCounter == 60){
    //write out your temperature
    //reset variables
    tempCounter = 0;
    temperature = 0;

There are several timer libraries available that will help you easily run the above code at some specified interval.  No need to reinvent the wheel, except as a learning experience.  But for that you can just read the code those libraries use.
746  Using Arduino / Programming Questions / Re: Floating point math on: February 01, 2011, 03:08:05 pm
That's great news, thanks! I need to do several dozen caculations in a second, so I probably have the time, and lots more to spare.

You could easily do several thousand calculations per second more than likely.
747  Topics / Robotics / Re: l293d motor shield for Tamiya on: February 01, 2011, 01:34:35 pm
You want VCC1 and all your logic inputs running off the Arduino power supply.
You don't want a 10k resistor inline with VCC1.
You need to flip the ground side diodes on your motor outputs.
All grounds should be tied together. (this includes Arduino and motor supply grounds)
748  Using Arduino / Programming Questions / Re: Floating point math on: February 01, 2011, 12:39:34 pm
The Arduinos are capable of both floating point math and trig functions.  They are relatively slow, but if you have the time, they will work.
749  Using Arduino / Programming Questions / Re: if statement and telnet combined on: February 01, 2011, 12:37:34 pm
You have all your code in setup().  That function only runs once, when the unit powers up to initialize.

You need to move most of your code into loop(), which runs continuously.  The only stuff that should be in setup() is your Ethernet, serial, and client setup.  You also need to move your analogRead() from your variable declaration into loop() as well, as that only runs when the variable is declared (as in just once as well, for a global variable)
750  Topics / Robotics / Re: l293d motor shield for Tamiya on: January 31, 2011, 11:54:08 am
1n4004 diodes aren't ideal for motor drivers.  You should really use a schottky diode for that purpose.  Something that should be well suited to the SN754410 as an example would be a 1n5818 schottky diode.  1amp current max, 30volts max, fits fairly well with that h-bridge IC.  If you really need 36v, you could go with the 1n5819 (or if you don't need more than 20v peak, the 1n5817).
Pages: 1 ... 48 49 [50] 51 52