Show Posts
Pages: [1] 2 3 ... 11
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial port 'COM19' already in use on: February 04, 2009, 12:04:02 am
Pull down Tools | Serial Port and try the other ports that're listed there.

2  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial port 'COM19' already in use on: February 03, 2009, 10:21:44 pm
Are you sure that COM19 is the right port to use?
3  Forum 2005-2010 (read only) / Troubleshooting / Re: 1000 booleans? on: October 12, 2009, 09:07:24 pm
Slightly more work but you could use an array of characters - index operator to pick a byte, bitwise operator to pick a bit. That way for each byte consumed you're getting 8 bits to set.
4  Forum 2005-2010 (read only) / Troubleshooting / Re: "function-definition is not allowed" error on: August 15, 2009, 10:49:28 pm
I believe you will find that jafadmin is mistaken. The arduino IDE will automagically generate prototypes for the functions you use.

In your case it looks like you have unbalanced {}s. Run over your code again looking for a {   where you don't have a } at the appropriate following spot. At a glance I found a missing }.

5  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial Help on: January 29, 2009, 10:35:18 pm
Can I ask why you elected to use a macro instead of a function with the inline modifier?
6  Forum 2005-2010 (read only) / Troubleshooting / Re: Problem uploading to board on: February 01, 2009, 07:32:57 pm
Pins 0 and 1 are consumed by the USB hardware when it is in use. Move the GPS off those pins and use softserial or unplug the gps when the USB is in use.
7  Forum 2005-2010 (read only) / Troubleshooting / Re: millis() is innacurate on my arduino. on: January 22, 2009, 06:56:51 pm
If you modified LiquidCrystal.cpp to not call into delayMicroseconds() when you're using the home() method then you might need to delete the LiquidCrystal.o file (I hear the arduino environment is a bit bad about detecting changes to library files) before asking it to rebuild your sketch.

8  Forum 2005-2010 (read only) / Troubleshooting / Re: millis() is innacurate on my arduino. on: January 22, 2009, 06:16:40 pm
From wiring.c :

/* Delay for the given number of microseconds.  Assumes a 8 or 16 MHz clock.
 * Disables interrupts, which will disrupt the millis() function if used
 * too frequently. */
void delayMicroseconds(unsigned int us)


And, looking inside the LiquidCrystal.cpp  :
void LiquidCrystal::home()
{
  command(0x02);  // set cursor position to zero
  delayMicroseconds(2000);
}


Your sketch is calling that home() function constantly so there's a good chance that the controller will be in the delayMicroseconds() routine with interrupts disabled when the counter overflows...

You might try replacing the home function with:
void LiquidCrystal::home()
{
  command(0x02);  // set cursor position to zero
  unsigned long waitUntil = millis() + 2L;
  while( millis() < waitUntil ) ; // Block until you've waited the minimum delay here.
}

I don't have an LCD to try this out with but the following sketch looks happy compared to my PCs clock

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  waitASec(5000);
  Serial.println(millis(), DEC);
}


 void inline waitASec(int i)
 {
   unsigned long timeToWait = millis()+i;
   while( millis() < timeToWait ) ;
 }
9  Forum 2005-2010 (read only) / Troubleshooting / Re: Dynamic Pause on: January 19, 2009, 11:32:12 pm
Have your interrupt service routine change the state of a global variable. Have your main loop block until that variable changes state.
10  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Reforming datatype practices on: February 04, 2009, 10:51:48 pm
Quote
Maybe it's just me, but I would prefer to think about what arduino the language *could* be, rather than weigh it down with preconceptions about C.


That's where I'm gonna have to say, "Please. No."

The big win of Arduino over BasicStamp (for instance) is that once you've outgrown a BasicStamp you've got a pile of proprietary pseudo-BASIC you then need to re-write into a 'real language'.

You outgrow Arduino you've got some workable C/C++ code ready for porting to another platform with minimal effort.
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: Bit Flipping Nibbles and Bytes on: October 22, 2009, 12:41:54 am
Couldn't this be done faster and easier with the ROL instruction?
12  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino Mega Pin Issues in 0017 on: October 23, 2009, 12:59:20 am
How're those pins wired up?
13  Forum 2005-2010 (read only) / Syntax & Programs / Re: LCD Underflow on: October 19, 2009, 11:36:09 pm
Quote
(I added a serial.print (millis()); line to the beginning and end of both methods to figure out the time, if that is a valid way)

That mechanism for timing won't be perfectly precise but it is certainly "good enough"


Quote
I wonder, does adding the function bring overhead that can be reused if the function is used in other places?

Pretty much, yeah. Once the function is in, it is in, and you can use it other places at no additional cost.
14  Forum 2005-2010 (read only) / Syntax & Programs / Re: LCD Underflow on: October 19, 2009, 11:06:24 pm
Quote
Another post here suggested it was slow and the if condition is fine.

Slow is relative. The arduino is clocked at 16MHz. 16 million clocks per second. Most instructions are retired in a single clock but the worst case is 3 clocks. But even if all of them were 3 clocks that's still 5.3 million instructions per second.

If you're in the middle of a tight inner loop for dealing with gyroscopic stability of a balancing robot then worry about timing. If you're updating a display with the current time who cares if the results are displayed a couple milliseconds faster or slower?
15  Forum 2005-2010 (read only) / Syntax & Programs / Re: LCD Underflow on: October 19, 2009, 09:35:16 pm
sprintf() is the function you want, it'll handle the zero-padding for you.
Pages: [1] 2 3 ... 11