Show Posts
Pages: 1 [2] 3 4 ... 20
16  Forum 2005-2010 (read only) / Troubleshooting / Re: real string functions? on: April 21, 2006, 07:41:22 am
hey thank you very much.

can't test it at the moment, but your answer seems to solve all the problems i encountered. nice to know that about string comparism in c.

best,
kuk
17  Forum 2005-2010 (read only) / Troubleshooting / real string functions? on: April 20, 2006, 06:41:51 pm
hello,

for a program i need to listen on the serial port and add all incoming characters to a string. if arduino receives a "carriage return" it shall compare it to other strings to see if the received string is a "command". then it should reset the string to "" (empty string).

the string examples in the tutorials don't work for me, because they all add letters in "while"-loop directly reading letters from the serial port. in my case, it might happen that there is a very long pause between the different characters. so i would exit the while-loop before the command is complete.

i looked into string manipulation in c, but wasn't successful.

basically i need something like this:
Code:
byte command[];

void handleIncomingByte( byte aCharacter) {
  if( aLetter=="13" ){   //if aLetter is a carriage return our string is complete
     //do some comparism
     if(command=="light"){
        //do something
     }

     //and important: reset command variable
     command="";
    
  }else{
      //add aCharacter to command
     command[strlen(command)]= aCharacter;
  }
}


both the string comparism and the resetting the string don't work.
what am i missing?
18  Forum 2005-2010 (read only) / Troubleshooting / Re: RFID with Arduino on: March 31, 2006, 04:17:15 am
what do you mean by launch? will they be for sale as an add-on or do you mean a tutorial will be available?

(just because shipping is quite expensive. thus i would wait for the rfid reader to be available before ordering a few boards for friends of mine. )
19  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: delayMicroseconds(0) on: November 15, 2007, 10:57:39 am
i agree, now that someone found out we should keep this in mind, i just meant to underline that.
peace,kuk
20  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: delayMicroseconds(0) on: November 14, 2007, 01:05:59 pm
i guess hard-coding a zero doesn't make sense here. still there's a big chance to invoke delayMicroseconds(0) if the parameter is dynamic, like "howManyButtonsPressed" to make it simple.
21  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: delayMicroseconds(0) on: October 12, 2007, 04:30:28 pm
yeah  smiley

thank you.
22  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: delayMicroseconds(0) on: October 12, 2007, 04:23:06 pm
hi mellis,
why is that? i'd really like to see where this is happening. could you briefly explain the function to help me get it?

23  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: delayMicroseconds(0) on: October 12, 2007, 04:12:06 pm
not sure if it matters, but are you running this on an atmega8 or 168 ?

your test output might be wrong though. this is the function definition of delayMicroseconds takne from libs/targets/arduino/wiring.c:

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

      // calling avrlib's delay_us() function with low values (e.g. 1 or
      // 2 microseconds) gives delays longer than desired.
      //delay_us(us);

      // for a one-microsecond delay, simply return.  the overhead
      // of the function call yields a delay of approximately 1 1/8 us.
      if (--us == 0)
            return;

      // the following loop takes a quarter of a microsecond (4 cycles)
      // per iteration, so execute it four times for each microsecond of
      // delay requested.
      us <<= 2;

      // account for the time taken in the preceeding commands.
      us -= 2;

      // disable interrupts, otherwise the timer 0 overflow interrupt that
      // tracks milliseconds will make us delay longer than we want.
      oldSREG = SREG;
      cli();

      // busy wait
      __asm__ __volatile__ (
            "1: sbiw %0,1" "\n\t" // 2 cycles
            "brne 1b" : "=w" (us) : "0" (us) // 2 cycles
      );

      // reenable interrupts.
      SREG = oldSREG;
}

i did not get into it too deep. but the lines
if (--us == 0)
            return;

(BTW: what are the two minus doing there?)
look as if they'd serve a close to zero delay. on the other hand, your real short delays (1µs) might disable interrupts to often which affects the millis() function. see the note at the beginning.

still it would be cool to get a real answer to your question.

24  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Request: bootloader options for brownout detec on: September 10, 2008, 04:16:24 am
PS: i'm using avr studio on a friends PC to burn the bootloaders. so i can't tell about the correct fuse settings for the BOD levels on the AtMEGA128 now.
25  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Request: bootloader options for brownout detec on: September 10, 2008, 04:12:49 am
same here. no more lost bootloaders or corrupt programs since enabling BOD on my 168's. i must say that i'm mostly running them from just 4 AA rechargables without a regulator. so lost bootloaders was a huge issue for me :-)

since this problem mostly appeared with my own creations, i believe BOD is disabled by default just because it's not needed in normal(PLUS) use, with a proper designed board. the only disadvantage of brownout detection i can imagine , would be unwanted resets in otherwise uncritical situations.
26  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Open multiple sketches for editing on: January 30, 2008, 07:24:48 am
Quote
 It's still not clear whether or not each window / sketch should have its own serial port setting and serial monitor.
hi david,
i now remember that you mentioned that you're working on it. please excuse my ignorance... concerning the serial port: as for copy and paste the port wouldn't matter, and i was originally assuming that one was working on a single project most of the time.
still, "multi-board projects" could become more popular with people starting to explore SPI, one-wire and stuff.
would it be hard to to save board and port settings in a sketch rather than in the application settings? i'm thinking of something like two pull-down menus at the top of each window.

best, kuk
27  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Open multiple sketches for editing on: January 29, 2008, 10:52:53 am
let me second this. i'm slowly getting the concept of how tabs are supposed to be used for includes, but copy and paste really is not easy as it is.


28  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Get a mail for every topic I reply to? on: January 14, 2008, 06:42:16 am
hi eberhard,
same problem here. it even feels like someone [david :-) ] changed the default setting within the last months. i think it's obvious that i'd like to be notified if someone responds to a post i did. but somehow it happens more and more that i find replies to topics that i wasn't notified of. did we really always have to check that box for notifications?

[turning on notification now]

kuk
29  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: AVR Bootloader burn error in Arduino 9 and 10 on: November 18, 2007, 11:16:46 pm
well i did burn my first bootloaders under AVR Studio and it was _much_ faster. is there any way to speed it up from within arduino? or do you recommend using AVR studio? i don't really mind the ten minutes for the handful burns that i do.

ps:

how does the board-selection in version 0010 work? i can't get the Diecimila bootloader burned on an atmega168 (inside an arduinoNG). burning completes successfully, but the chip is useless. it just continously blink on pin13. if i select the ArduinoNG as a board and bootloader everything works fine. just with the old bootloader, which doesn't timeout on invalid data, or does it?
with version 0009 i had no problems burning each with the same hardware setup!?

//kuk
30  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: AVR Bootloader burn error in Arduino 9 and 10 on: November 18, 2007, 03:04:50 pm
just wanted to throw in that i'm successfully burning bootloaders to atmega168s using an mkII + an arduinoNG on an Intel Macbook running 10.4.9
thank you very much for this feature. if it does not work for anyone and you're sure that your mkii is not dead, check those 3 things mentioned before:

- arduino has to get power from an external source (wall plug)
- set the power source jumper on your arduino accordingly
- plug-in the ICSP-cable correctly.

if the programmers shows the green light (instead of red or orange or blinking or something ) the hardware part should be fine. Start the arduino application _now_ and begin burning your bootloader (or sketch soon :-).

the arduino app seemed frozen when i did it the first times, not telling me something new for a couple of minutes, just a "burning bootloader". the process takes something like 5-10 minutes on this machine, but it works. After some lightshow, the programmer shows the green light again, and arduino tells me "Done burning bootloader". No other messages in between, which you just have to know.



Pages: 1 [2] 3 4 ... 20