Show Posts
Pages: 1 ... 39 40 [41] 42 43 ... 53
601  Using Arduino / Programming Questions / Re: What affects the size of the sketch? on: April 22, 2011, 01:32:53 pm
the fact is that I have compiled a 30K, I remain free under 1K ...
and the project is the middle ...

That would be the binary then, not the sources.
602  Using Arduino / Programming Questions / Re: What affects the size of the sketch? on: April 22, 2011, 01:21:13 pm
I don't see any point in being at all concerned with the size of your sources.
603  Using Arduino / Programming Questions / Re: How to use windows .bat file instead of serial monitor? on: April 21, 2011, 12:06:05 pm
Keep in mind that the auto-reset is used when downloading sketches to the Arduino.  If you disable the auto-reset, you will have to manually reset the Arduino when downloading sketches.
604  Using Arduino / Programming Questions / Re: waiting for input from keypad? on: April 21, 2011, 10:15:41 am
What keypad are you using and how is it connected to your Arduino?
605  Using Arduino / Programming Questions / Re: multifunction on: April 21, 2011, 09:12:52 am
Learn C++.  Then you will understand.

Google is your friend.  Try Googling a few of the following:
learning c++
c++ tutorials
getting started with c++
606  Using Arduino / Programming Questions / Re: How to receive two digit number by Serial.read()!n00b! on: April 21, 2011, 09:10:08 am
Serial.read() gets a single character.

'1' is a single character.
'2' is a single character.
'20' is two characters.

I recommend separating your numbers by some non-numeric character (typically a comma).  Then you can read in characters until you see a comma, and pass those characters on to atoi() to get the int value of those characters.  Done right, it should be able to handle any size number (though you will still be limited by the size of number int can store, or long if you switch to that datatype).
607  Using Arduino / Programming Questions / Re: multifunction on: April 21, 2011, 08:31:35 am
  TIM_Stop() ;
  TIM_Set(10000) ;
  TIM_Start() ;

You've defined these function as members of your timer class.  As a result, they are only accessible through an instance of your timer class, ex:

timer myTimer;

myTimer.TIM_init();

That being said, since your timer class depends on the hardware timer, it's really not suited to creating multiple instances of timer.  You can address that by making the timer class a singleton (not really recommended), or declaring all your methods as static, making them accessible without creating an instance of the class.

I'd personally recommend you go back to the basics and learn more about how to use classes in general.  Google can provide plenty of online resources for doing so.
608  Using Arduino / Programming Questions / Re: multifunction on: April 20, 2011, 10:13:36 am
http://arduino.cc/en/Hacking/LibraryTutorial
609  Using Arduino / Programming Questions / Re: How to run the program only ONCE? on: April 19, 2011, 11:24:27 am
My favourite is:
Code:
#define EVER (;;)

// then...
for EVER;

Hehe.  I like that.
610  Using Arduino / Motors, Mechanics, and Power / Re: Possible to move 2 motors, simultaneous, smoothly, accurately? on: April 19, 2011, 07:13:29 am
What type of servos were you using?  Not all servos are created equal.  What sort of positioning resolution do you  need out of the system?

The micro gear motors are only going to be half of what you need.  The motors themselves have no positional control to speak of.  You'd need some form of encoder feedback and then a controller to handle positioning of the motors, not a trivial task.  So actually, they're only about a third of what you need.

What you may want to do is look at the dynamixel servos.  They may provide the control you need.  They will not work with the sparkfun pan/tilt, but Trossen Robotics provides a dynamixel compatible pan/tilt platform as well as the dynamixel servos themselves.
611  Using Arduino / Programming Questions / Re: teensyduino code on: April 18, 2011, 01:19:22 pm
If you want to be able to handle more than 6 buttons, the code will get a bit more complicated as the USB Keyboard protocol only allows registering up to 6 keypresses at the same time (this is why the Teensyduino keyboard class has six separate methods for issuing a keypress).

Up to 6 buttons can be done fairly easily by duplicating this block of code:
Code:
boolean boolBtnUp = !digitalRead(pinBtnUp);
 
  if ( boolBtnUp )
  {
    //Set key1 to the U key
    Keyboard.set_key1( KEY_U );
  } else {
    Keyboard.set_key1( 0 );
  }

up to six times, changing the set_key# function that is called for each one, from set_key1() to set_key6().  As I said at the beginning though, writing code to handle  10 buttons becomes a non-trivial task (and you still would not be able to register more than 6 button presses at any one time)
612  Using Arduino / Programming Questions / Re: Arduino & thread on: April 18, 2011, 09:15:07 am
simply believe it is better to avoid putting the "RTC.refresh ()", solving with something that just works without requiring you to manually refresh, so I thought of the thread.

That can be solved using one of the hardware timers.  Look at the Timer2 library in the Playground.  You'll see that, once it's set up to run at some interval, there is no regular 'refresh()' call required in the main loop.  Threads are not only not necessary, but the complete opposite of an elegant and clean solution to a rather simple problem.

Though to be perfectly honest, the perceived issues with using a refresh() call in the main loop are questionable as well.  The whole point of loop() is to execute code over and over and over, so any objections to using it for that purpose are objections to it's whole existence.

Utilizing a hardware timer requires the use of an Interrupt, which has it's own suite of snares and hurdles to deal with, and should really only be used when real accuracy is required, and I can't think of anything involved with controlling an aquarium that would require more than second resolution accuracy, never mind millisecond or microsecond resolution accuracy.

So, to put it simply, I simply believe it is better to use an RTC.refresh().  You're creating a problem where there isn't one, and looking for a solution that is more complicated, more error prone, and more obtuse.
613  Topics / Robotics / Re: How to control a 4wd robot to move by arduino? on: April 14, 2011, 03:39:32 pm
Quote
1.The code above controls only two motors, when I control four motors, where should I change?

When dealing with fixed orientation motors/wheels, controlling four motors is the same as controlling two motors, because you should be controlling the motors in pairs.  There's no reason for the two motors on the left side to be driven separately (same for the right side).  Ideally, just wire the two left motors in parallel to the motor controller (making sure the motor controller can handle the current of two motors), and then wire the two right motors in parallel to the motor controller.
614  Using Arduino / Programming Questions / Re: Converting String to an Integer. on: April 14, 2011, 07:57:11 am
http://arduiniana.org/libraries/tinygps/
615  Using Arduino / Programming Questions / Re: To debug or not debug... That, is the question! on: April 14, 2011, 07:54:19 am
I was describing the behavior when the USART has not been enabled, as that was the original posters question regarding how prints work without any call to begin().  If the USART has not been enabled, then the UDRE bit of UCSRA register will always be set, because the USART will not spend any time shifting out any data, and in fact won't even bother clearing the UDRE bit when you push a byte into the UDR register.

If the transmitter is enabled, then it's a completely different story.
Pages: 1 ... 39 40 [41] 42 43 ... 53