|
331
|
Using Arduino / Microcontrollers / Re: UNO as ISP?
|
on: April 09, 2011, 05:14:03 am
|
|
It's strange that you managed to upload the bootloader and Blink to the breadboard, but cannot upload anything else. Which bootloader are you using? The Uno bootloader is designed to work with auto-reset, so only waits a very short time for programming to start. Are you certain that the Arduino is configured with RX and TX as inputs?
If programming via the TX/RX pins doesn't work, rearrange everything as for the bootloader installation and try uploading sketches via ArduinoISP.
|
|
|
|
|
332
|
Using Arduino / Programming Questions / Re: C++ for Arduino: any tips?
|
on: April 08, 2011, 06:17:29 pm
|
|
Thanks guys. I think I can manage without static globals, though exception handling could have been useful. The comments on the build process were interesting and prompted me to look a little further into it. If anybody is using a Makefile instead of the IDE, I'd be interested to hear their comments.
|
|
|
|
|
333
|
Using Arduino / Programming Questions / C++ for Arduino: any tips?
|
on: April 07, 2011, 10:19:22 am
|
|
After using plain C for some 20 years, I am finally getting around to learning C++. Apparently it is generally considered that C++ is not ideal for micro-controller programming. However a number of Arduino libraries are written in C++. And writing a few little test routines, I was pleased to see that compiled binaries from Object-Oriented code were barely larger than their non-OO equivalents. Including Mikal Hart's <Streaming.h> library actually made some sketches shrink.
So I thought I'd just ask here if anybody has any thoughts, tips, or pointers regarding C++ on the Arduino?
PS. If anybody else is thinking of moving from C to C++, but has been put-off (as I was) by poor explanations in huge multi-volume textbooks, I can recommend Gregory Satir & Doug Brown's book, published by O'Riley.
|
|
|
|
|
334
|
Using Arduino / Microcontrollers / Re: UNO as ISP?
|
on: April 05, 2011, 06:31:16 am
|
|
Yes, the 10uF capacitor should normally disable the reset. But if the modified sketch is being uploaded to the Arduino, it must be being reset somehow.
|
|
|
|
|
336
|
Using Arduino / Microcontrollers / Re: UNO as ISP?
|
on: April 05, 2011, 03:50:41 am
|
|
In this setup you have two micro-controller chips connected to the same serial interface: one on the Arduino board, and one on the breadboard. In order for this to work, one of the chips must not interfere with the serial interface signals whilst the other is being programmed. It sounds as though the chip on the Arduino board is being reset, causing its bootloader to take over the serial interface. Check that the Arduino chip has its reset suppressed, and has its RX and TX pins both configured as inputs.
|
|
|
|
|
337
|
Using Arduino / Microcontrollers / Re: Burning Bootloader+program at once through spi
|
on: March 31, 2011, 11:00:16 am
|
|
Isn't it impossible to erase the bootloader by accident? And normally the application lives at one end of the memory and the bootloader at the other, so even if the memory-lock bits are reset, the application will only overwrite the bootloader if it occupies almost all the available memory.
|
|
|
|
|
338
|
Using Arduino / Microcontrollers / Re: UNO as ISP?
|
on: March 31, 2011, 06:18:29 am
|
|
If you've disabled auto-reset on the UNO, it should be able to upload sketches to the breadboard chip. AFAIK ArduinoISP uses the same upload protocol as the bootloader, so to Avrdude and the Arduino IDE it should appear like a normal Arduino board. Keep the wires connected as they were for installing the bootloader and try it.
|
|
|
|
|
340
|
Using Arduino / Sensors / Re: Experience with inertial positioning?
|
on: March 30, 2011, 08:05:58 pm
|
|
Yes, sorry, I used completely the wrong term. Inertial positioning is what I should have said.
What I have in mind is double-integrating the 3D acceleration to get position, assuming the sensor does not rotate. Then I'd like to remove the rotation constraint by incorporating readings from a gyro.
The specs for reasonably-priced sensors seem amazingly good, but of course the errors will grow enormously once integrated over time. The 650m/hr figure on Wikipedia is discouraging.
|
|
|
|
|
341
|
Using Arduino / Sensors / Experience with dead-reckoning navigation?
|
on: March 30, 2011, 04:27:36 pm
|
|
Hello, Has anybody got any experience with gryo and accelerometer sensors? I'm wondering how fast the errors accumulate when calculating relative-position by dead-reckoning. For example, if a rover equipped with one of these sensors sets off to do a lap of a room, how near could it get to its starting point after (say) a minute?
|
|
|
|
|
344
|
Using Arduino / Microcontrollers / Re: Need to print pointer address to uart without using printf or sprintf
|
on: March 29, 2011, 11:46:23 am
|
These versions may be slightly clearer. They avoid typecasting the integer into a character array. See any C reference for an explanation of the '>>' and '&' operators. This writes out the address as a binary number /* initialisation */ uint16_t ptr;
/* these lines go inside the loop */ ptr = (uint16_t) &value; // store 16-bit address of 'value' putchar( (char) (ptr >> 8) & 0xFF ); // Write out high-byte of memory address putchar( (char) (ptr >> 0) & 0xFF ); // Write out low-byte of memory address
This writes out the address as human-readable hexadecimal text /* initialisation */ char string[]="0123456789ABCDEF"; // array of characters corresponding to numbers from 0 to 15 uint16_t ptr;
/* these lines go inside the loop */ ptr = (uint16_t) &value; // store 16-bit address of 'value' putchar( string[ (ptr >> 12) & 0xF ] ); // Write out highest 4-bits of memory address putchar( string[ (ptr >> 8) & 0xF ] ); putchar( string[ (ptr >> 4) & 0xF ] ); putchar( string[ (ptr >> 0) & 0xF ] ); // Write out lowest 4-bits of memory address
|
|
|
|
|
345
|
Using Arduino / Microcontrollers / Re: Need to print pointer address to uart without using printf or sprintf
|
on: March 29, 2011, 10:42:42 am
|
How do you know that the pointer will be a 16-bit address? I looked at the avr-libc pages. They indicate that a uint16_t is an unsigned integer and is 16 bit. On some other places on the internet an unsigned integer is a 4 byte variable (or 32 bit). Not sure why there is a difference here, maybe depends on the system you are using the variable on.
A pointer is just a memory address, so the size of the variable storing the pointer value has to match the size of the memory address. I was assuming you were using an ATmega328 or 168, which have 16-bit memory addresses. So my code would not work on a processor with a larger memory space. A uint16_t is always 16-bit by definition, whereas the size of an int varies depending on the platform and compiler. The pointer value that I am trying to display is iterating. I try to display it after each iteration, but the value doesn't update when outputed to uart. Are there issues regarding outputing a pointer at runtime?
You'll need to re-read the pointer each time it changes. So after every iteration you'll need to do this line before writing to the serial port: uint16_t ptr = (uint16_t) &value; // store 16-bit address of 'value'
|
|
|
|
|