arduino output file

Good morning! I'm a new member of this forum and I don't speak English very well, sorry! :) I have a question about ARDUINO DUEMILANOVE: can I obtain an output file (like the output text file of Nastran) by ARDUINO DUEMILANOVE where I can read information about its running? Thank you!

Where do you want the file ?

Arduino has no disk, or file system in it self.

You can use Arduino together with some extra hardware and a SD memory card.

I you want Arduino to write to a file on your PC, you can use GoBetwino to do it for you (Windows only)

http://mikmo.dk/gobetwino.html

Without added hardware, the Arduino does not have the ability to create or store text files.

If you add an SD card, you can perform data logging. You would need to stop the Arduino to remove the SD card, and transfer the data to a PC for further use.

You could program the Arduino to send information to the serial port, and write a program on a PC to collect that data. The disadvantage of that method is that the Arduino would need to stay connected to the PC at all times.

If you explain a little more about what you want in the the output file, and what else the Arduino is doing, perhaps there are other options that could be proposed.

I use arduino to control a digital brushless servo; for example, I write a code that makes to turn my servo and I need to know, if it’s possible, how arduino does it. I need a sort of feedback by arduino about its running.

This does not sound like a long term need. It sounds more like your code is not working right, and you are trying to debug it.

If that's the case, using Serial.print while the Arduino is connected to the PC, and opening the Serial Monitor window, is much easier, and provides much faster feedback than writing to, and reading from, a file.

Thanks PaulS, your help was precious! Now I know that my code is right! But my question was not clear: I need feedback data by the servo running not by arduino and I don't know how to obtain that because in my code I want that the servo turns of 180° instead the angle that it covers is smaller. For me is the first time with a servo and an arduino :-/ Thanks for your attention!

Could you do what you want by using gears to get the range?

When you say the angle is smaller, is it like, only 20 degrees, or is it more like 150 degrees?

There seems to be no agreed definition of how far a servo should turn - the arduino convention of 0 to 180 is just a convenience and an approximation.

It is like 30-40 degrees. The code I wrote is very simple because this is the first time for me so I used servo library. Do you know how I can tell the servo the angle I want it covers? Probably I have to work on the pulse width...

Can you post your code (use the # button) so that we can see what you're doing?

[#include <Servo.h>
Servo futaba352;
int pos=0;
int num_esec=3;
int c=0;
void setup()
{
futaba352.attach(2);
}
void loop()
{
if (c<num_esec)
{
for(pos=0; pos<=180; pos+=1)
{
futaba352.write(pos);
delay(20);
}
for(pos=180; pos=0; pos-=1)[code][/code]
{
futaba352.write(pos);
delay(20);
}
c++;
}
}][/code]
I hope that the thing I have done is right! :-[
I wrote this code, using servo library, like first attempt. I would the servo turns, for 3 times, from 0 to 180° and back.

it is clear that I got it all wrong!Sorry :-[

#include <Servo.h> 
Servo futaba352; 
int pos=0; 
int num_esec=3; 
int c=0; 
void setup()
{
  futaba352.attach(2); 
  }
  void loop()
  {
    if (c<num_esec)
    {
      for(pos=0; pos<=180; pos+=1) 
      {
        futaba352.write(pos);
        delay(20);
        }
        for(pos=180; pos=0; pos-=1) 
        {
        futaba352.write(pos);
        delay(20);
        }
        c++;
        }
        }

Now it’s better! :wink:

So you’re saying that the servo only turns about 20 or 30 degrees with this?

#include <Servo.h> 
Servo futaba352; 
int pos=0; 
int num_esec=3; 
int c=0; 

void setup()
{
    futaba352.attach(2); 
}

void loop()
{
    if (c<num_esec) {
        for(pos=0; pos<=180; pos+=1) {
            futaba352.write(pos);
            delay(20);
        }
            
        for(pos=180; pos=0; pos-=1){
            futaba352.write(pos);
            delay(20);
        }
        c++;
    }
}

Have you tried any other servos?

No, the servo only turns about 130-140 degrees with this. I have only this servo so I can't try with another. What do you think about the code? Could it be right to control my servo? At least in the beginning...

Try changing the limits from 180 to 90. See if the servo then moves through a 90 degree sweep. If it does, then the servo you have won't sweep 180 degrees.

If, with limits of 90, you get less then 90 degrees of motion, try changing the limits to something greater than 180. Something like 210, maybe. See if that increases the sweep angle that the servo actually moves.

Hold on - is it 30-40 degrees (reply #9) or 130-140 degrees (reply #13)?

It may be that the servo won't do 180 degrees, or it might just be that you need to try the "writeMicroseconds" method in the Servo object, to push the pulse width to the extremes of its range. Try replacing your loops with something like

for (int pulseWidth = MIN_PULSE_WIDTH; pulseWidth  MAX_PULSE_WIDTH; pulseWidth+= 10) {
  Servo.writeMicroseconds (pulseWidth);
  delay (20);
}

and see if that makes a difference.