Show Posts
Pages: 1 2 3 [4] 5 6 ... 71
46  Using Arduino / Programming Questions / Re: delay() & equivalent not working. on: May 17, 2013, 07:59:53 pm
You're not using delay() or millis() from within an interrupt are you ...?

Yes, a slow one. Didn't know that was an issue but it does make sense thanks.
So you're starting to realize why most people ask you to post all of your code rather than just what you think is the problem?
47  General Category / General Discussion / Re: WHAT SHOULD I UNDERSTAND????????? >:( on: May 14, 2013, 07:40:45 pm
On some forums I frequent, there is a rule that says post bumping is not allowed. Instead, you post more information about your problem.

If your post is incomprehensible it's unlikely you'll get replies; if it's sloppy then it shows you don't want to spend much time and other people won't want to either.
48  Using Arduino / Programming Questions / Re: STRING To HEX Converter on: May 08, 2013, 12:20:00 am
Quote
How to convert a text string "003C" to Hex value 0x003C ?
Use strtoul().

Or even better -- don't use strtoul(). In fact, don't use the C++ string library at all, if you can possibly avoid it.
strtoul was in C. What's wrong with it? It does the same thing as your code except probably faster because it's optimized and debugged.
49  Using Arduino / Programming Questions / Re: Arrays in Header Files - Not Integer Constant Error on: May 08, 2013, 12:17:32 am
An int can be changed. A const int cannot.
50  Using Arduino / Programming Questions / Re: Help with Wire.write() type. on: May 04, 2013, 08:12:45 pm
register is a (never used) C keyword. Just like you can't have a variable named for or int, you can't have a variable named register
51  Using Arduino / Programming Questions / Re: Millis Accuracy Again on: April 30, 2013, 11:19:04 pm
GoForSmoke,

True, getting rid of delay() was suggested several times.   It was just very counter-intuitive.

Back to Unix-land, using sleep() allow other processes to run (or lets the CPU go into low-power mode, if there are no runnable processes), but using a do-nothing loop spins the CPU which keeps power consumption up.

While the Arduino is single-tasking, I would have thought that allowing it to power-down when doing nothing was good.  Or maybe delay() isn't smart enough for that.. or the AVR CPU doesn't have that capability.  The STM32 CPU's do have the capability to clock down to 4MHz and even go into deep sleep, then wake up on interrupt.

(incidentally I will probably port this code to an STM32 going forward, the boards are laughably cheap and the processors significantly more powerful)
Strange how things change when you have 2 million times less RAM...
52  Topics / Robotics / Re: Kinect/Ardunio/Processing and 5 Motors on: April 30, 2013, 10:15:52 pm
Im having great difficulty getting this to work. I'm still stuck on trying to get the kinect to power 5 servo motors. I havent even gotten processing to communicate with the arduino. Any tips?
You need to do all of this:
  • Control 1 servo with arduino (sweep example) (Arduino -> Servo)
  • Control 5 servos with arduino (sweep example + arrays) (Arduino -> Servos)
  • Make kinect do something interesting on computer (In processing, println("servos should be moving right now"); This is probably the hardest step). (Kinect -> Processing)
  • Make processing talk with arduino (When it sends "hello" the arduino flashes an LED) (Processing -> Arduino)
  • Make kinect talk to arduino via processing (Kinect -> Processing -> Arduino)
  • Kinect -> Processing -> Arduino -> Servos

Which are you having trouble with? Give specific details so that we may help.

Hi

I am new user here. I am trying to do the same thing for my senior project and I am having trouble making the servos move when I move in front of the kinect. I am able to see the processing window and the code from what I believe compiles without any issues. Can you please let me know what could be done or any tips would be helpful?

Thanks is advance!
My same advice that you quoted applies to you, too. Go incrementally (or take stuff out incrementally) so you can isolate any problems you may have. If you made the processing program print out when the servos should be moving and the arduino flash an LED when they should be moving you can narrow down where the problem is very quickly.
53  Using Arduino / Programming Questions / Re: How come this happens when upgrading to a newer version? on: April 28, 2013, 11:05:41 am
First, you need to answer the question "How are you compiling the code?". The IDE does not display warnings, so that fact that you are seeing them implies that you are not using the IDE.
It does when verbose mode is on, which is probably what he's doing.
54  Using Arduino / Programming Questions / Re: Writing data into flash instead of EEPROM on: April 26, 2013, 10:11:10 pm
Suppose EEPROM runs out of space. Is it possible to write data into flash instead of EEPROM?
not unless you're a bootloader. The arduino has a harvard architecture (look it up)

Sorry, I am not knowledgeable enough to understand the link between harvard architecture and not being able to write non-volatile data to Flash. Do all MCUs which use harvard architecture have to use an EEPROM and cannot write to internal ROM flash?
yes. Harvard means that code is in one place and data is in the other, so you can't put anything in the code section. However, since you need to load code somehow, they made it so the bootloader can write to the code section.
55  Using Arduino / Programming Questions / Re: Writing data into flash instead of EEPROM on: April 26, 2013, 07:23:24 pm
Suppose EEPROM runs out of space. Is it possible to write data into flash instead of EEPROM?
not unless you're a bootloader. The arduino has a harvard architecture (look it up)
56  Using Arduino / Programming Questions / Re: What sketch is loaded? on: April 26, 2013, 07:22:40 pm
So I assume Serial.println(F(__file__));

would work, too.
Yes, as reply #6 said.
57  Using Arduino / Programming Questions / Re: What sketch is loaded? on: April 25, 2013, 08:37:48 am
Does the Arduino compiler waste AVR memory by storing that data when it uploads a sketch?

If so how can I stop it?

...R

One possibility:

Code:
void setup(void)
{
    Serial.begin(115200);
    Serial.println(__FILE__);
    Serial.println(__DATE__);
    Serial.println(__TIME__);
}

void loop(void)
{
}
Code:
Serial.println(F(__FILE__));
?
58  Using Arduino / Programming Questions / Re: how to suppress leading 0's in a number on: April 25, 2013, 01:43:19 am
Just delete the 0. If you didn't type the 0 (ie you don't want to manually delete it); where did it come from?

If you're using atoi, it's always base 10 and in other conversion methods you can specify the base.
59  Using Arduino / Programming Questions / Re: What sketch is loaded? on: April 24, 2013, 10:57:42 pm
Why would you have multiple bare arduinos with different programs on them? I have some that are actually in robots and sometimes another one I use to test out things that just use the serial monitor, but I never have two arduinos not attached to anything that I'm using at the same time.
60  Using Arduino / Programming Questions / Re: How to put const char in sprintf func on: April 24, 2013, 12:49:32 am
Code:
PROGMEM const char mystring[] = "This string is in PROGMEM";
void setup() {
  Serial.begin(115200);
  char buf[256];
  sprintf(buf, "What's my string? Oh yeah, it's %S", mystring);
  Serial.println(buf);
}
void loop() {}
http://nongnu.org/avr-libc/user-manual/group__avr__stdio.html#gaa3b98c0d17b35642c0f3e4649092b9f1
Pages: 1 2 3 [4] 5 6 ... 71