Show Posts
Pages: 1 ... 44 45 [46] 47 48 ... 81
676  Using Arduino / Programming Questions / Re: where is the error ??? on: April 08, 2012, 01:01:12 pm
At this risk of sounding a bit overbearing - have you tried to understand what is happening with a "blocking" call? My explanation may not have been clear, sorry about that.

Try and use the "#" button on the input editor so your code comes in a box, ie is surrounded by the "code" brackets. (it is not just pretty that way, there are some formatting issues, too)

Meanwhile, the problem is that you still use
Code:
stepper.step(200);
which does 200 steps, and while doing so does NOTHING ELSE. SO you have to "manually" in your program alternate between one step with one motor and one step with the other motor in an apprioate ratio
Code:
stepper.step(1);

677  Using Arduino / Programming Questions / Re: asprintf replacement for arduino on: April 08, 2012, 06:02:13 am
Well, I did a text sdearch in my arduino code home, and found the HTML file that describes "libiberty", wherethe function is described. I can also see that the object file is there, but there is no ".h" defining the prototype. Defining one myself works for compiling but fails on link. So - and this is where I gave up - one needs to specfically ask to include the lib/libiberty.a file in the link.

On a completly different note: The microcontroller chip has limited RAM. Doing things with malloc etc works, but people who do so usually very quickly exhaust memory. And being a microcontroller, there is no pretty "program memory exhausted" message as the program exits, as there is nothing to exit to; It just keeps on running, looping, crashing, hanging until the reset button is pressed.

Handle your own buffers. smiley
678  Using Arduino / Programming Questions / Re: where is the error ??? on: April 08, 2012, 05:33:07 am
No, one Arduino can comfortably control several steppers. The typical 3D printer uses 4 motors and one Arduino.

Your code at the moment does something like
Code:
Move StepperOne 200 units
Move StepperTwo 100 units
What you need is something more like
Code:
Repeat 200 times:
  Move StepperOne one unit
  Has StepperOne moved an even number of times?
    Yes - Move StepperTwo one unit
So yes, the program suddenly becomes more complicated. In my example above I have assumed a fixed ratio (2-to-1). You can have any ration (a rational fraction to be mathematical correct) with a bit of integer math to decied if the slower stepper needs to move a step.
679  Using Arduino / LEDs and Multiplexing / Re: Fairly new, questions about power and LEDs on: April 07, 2012, 03:10:22 pm
1: No
2: No
3: RFID reading is a lot more difficult than powering LEDs ...

The Arduino single pin can only supply 40mA - and that will damage it in the long run. So you need a MOSFET to let something run the 200 to 600mA (depending on your LEDs). If you limit the LED current so that the total is under 300mA or so, then you could run it of the Ardiuno board suppy (the 5V pin), but it would be better with a seperate supply for the LEDs (which goes through MOSFET). The MOSFET gate can be directly controlled by the Arduino.

Plenty of examples around on this site (the Tutorial and Playground area)
680  Using Arduino / Programming Questions / Re: where is the error ??? on: April 07, 2012, 02:56:44 pm
( Not too happy about downloading a video file - would preer a YouTube or Vimeo link )

I'd prefer some better names rather than "stepper" and "mystepper" - Iike Xmove and Ymove or Swingarm and Lifter

The motors are doing what you ask them to: You move "stepper" a bot forward a bit backward. Then you move "mystepper".

The problem with the Stepper library is that the calls block - ie. no other code is executing while one motor moves. So the only way to get simultaneous movement is to call the two stepper motion with only one step, and the relative number of times you call them is the ratio you want the motors to move at.
681  Using Arduino / Installation & Troubleshooting / Re: Arduino Hangs and LED Switches On After Serial Monitor is Opened on: April 06, 2012, 03:39:06 pm
Rev 1 or 2. The bootloader integrity is beyond my immediate knowledge. I used Rev 022 of the IDE, but I am sure that is not of importance. Backward compatability and besides the pre-setup stuff is part of the core, not the bootloader.
682  Using Arduino / Interfacing w/ Software on the Computer / Re: Why does PuTTY hang my Duemilanove? on: April 06, 2012, 02:27:44 pm
Just also used my Mega which also uses the 8U2 chip. Same result testing as the UNO.

Update: Just setup the USB-FTDI cable, so I talk to the Duemilanove via the TX/RX pins and not via the USB port. Power is via external adaptor. And that works.

So something has fried something on the FTDI ... but I still dont get why it matters which software drives it? (tried all PuTTY setting with respect to DTR, CTS)
683  Using Arduino / Installation & Troubleshooting / Re: Arduino Hangs and LED Switches On After Serial Monitor is Opened on: April 06, 2012, 02:14:43 pm
I have a Mega 2560, an older Duemilanove, and a UNO. Loaded with the "Examples, Bare Minimum" from a IDE version 022, LED 13 is OFF whether I power on via USB or external supply.

I suspect you have a corrupted boot loader or something bust on your board. Look around for reloading the boot loader (requires a 2nd board or Programmer). Comming to think of it ... I do not know if you have the newer Opti-loader or the good ol' one (and I do not know how to check)

(BTW - I, too, have a mystical problem with a board behaving differently depending on the seriel connection - but sort of opposite to yours.)
684  Using Arduino / Interfacing w/ Software on the Computer / Why does PuTTY hang my Duemilanove? on: April 06, 2012, 11:15:41 am
I have an (older) Arduino Duemilanove and an Arduino UNO. The older uses the FTDI the newer the 8U2. My host systems are a Win XP and a Win7(64bit.) Drivers have been reintstalled/updated.

On both systems the UNO works fine, with SerialMonitor and PuTTY, I can run some simple Serial-echo program.
On both systems the Duemilanove does not work with PuTTY, but works fine with the SerialMonitor of the IDE. There also is no problem programming.

When using the PuTTY serial connection (on either host) the Duemlianove freezes. None of the LEDs flicker when Putty opens the serial connection. The reset button doesnt do anything either. I do not think it is my PuTTY settings, as I have used PuTTY a long time (occasionally) and had no trouble previously. (I have a video proving it), Unfortunatly I can not with certainty say when it last worked (as in - "what did you do when it stopped working")

Note: with the SerialMonitor everything works as expected (LEDs briefly flash, programs starts, resetbutton works)

The natural thing is to assume that the Duemilanove is damaged (?) but what/where/how? Some small speck of ironfiling stuck somewhere? And what does the PuTTY serial do that is soooo different to the SerialMonitor that it totally freezes (or loops or whatever)?
685  Community / Bar Sport / Re: Laws of the Forum on: April 06, 2012, 06:26:48 am
Getting back to the subject heading as I understood it (ie like Murphys Laws)

The 80/20 law: 80% of the threads cover 20% of the problem space.

Well, it is a bit exagerated, but these laws usually mention 80/20 (or 90/10)
686  Using Arduino / Installation & Troubleshooting / Re: Arduino Hangs and LED Switches On After Serial Monitor is Opened on: April 06, 2012, 06:07:58 am
I once established that after powerup, and bootloader has determined that no new sketch is comming, ie. it is ready to start your setup() routine the following has happened:
All variables are set to 0. All pins are set to input, except pin13 which is set to output, and pin13LED is off.

So if yours is on, it is stuck somewhere in the bootloader.  Depending on the bootloader (I think) and what is happening on serial input there is some blinking with pin 13 to signal powerup/bootload progress. How much are the RX/TX LEDs blinking?
687  Using Arduino / Programming Questions / Re: quick question on: April 04, 2012, 03:27:56 pm
Everything up to the loop() looks good. (You need to change the "val" declaration to two declarations to match this code)
Code:
void loop(){
  fan1val = digitalRead(fan1);   // read input value and store it in val
  fan2val = digitalRead(fan2);   // read input value and store it in val
  if (fan1val == LOW && fan2val == LOW) {               // check if both inputs show fan OK (Switch is pressed)
    digitalWrite(greenled, HIGH);   // turn green on
    digitalWrite(redled, LOW);   //  .. and red off
  } else {   // we do not need to test the opposite -  we do not light green, we light red
    digitalWrite(greenled, LOW);    // turn green
    digitalWrite(redled, HIGH  // .. and red on
  }
}
Normally I do not like writing the code - I like giving a hint, but you wrote "having a mental block" and I can sympasise with that. The leap from "one" to "two" is sometimes hard.

Now if your switch/fan monitoring has a 3rd state, then you need to do "if then else if else" construction - or three seperate if statements. There are pro&con to
688  Using Arduino / Motors, Mechanics, and Power / Re: Newbie help on controlling speed and direction of a dc motor using H-bridge L293 on: April 04, 2012, 08:12:50 am
The "enable" is on pin 9, which is PWM as the article says. Try analogWrite(9,127) or analogWrite(9,20) :-)
689  Using Arduino / Programming Questions / Re: How to Serial.print in Putty? on: April 03, 2012, 03:24:30 pm
That should work if the USB cable is connected, the Putty is set to the Serial port that the USB driver creates, and at 9600 baud.
690  Using Arduino / Programming Questions / Re: Time Interrupts on: April 03, 2012, 11:29:44 am
The code you outline does not need an interrupt - you can simply wait until the threshold is reached.

Is there some "timeout" that is not included in your outline? That, too, can be done without interrupts, by checking time (millis) while you are waiting for the threshold.

Otherwise - a more detailed outline
Pages: 1 ... 44 45 [46] 47 48 ... 81