Show Posts
Pages: 1 ... 51 52 [53] 54 55 ... 116
781  Using Arduino / Programming Questions / Re: how to increase the size of an array? on: March 03, 2013, 07:34:16 pm
I was under the impression that the limit for avr-gcc was 32kB arrays (or 32k elements, whichever is smaller).

I just tried and had no problem compiling a program with an array of 8193 elements. I did try declaring the array as 8192 bytes and adding an extra and got the error message you reported. It looks like you have given too many initialisers as the error suggests (you specified more elements than fit in the array length you specified).
782  Using Arduino / Programming Questions / Re: error: invalid conversion from 'char' to 'const char*' on: March 03, 2013, 07:09:48 pm
(1) @PaulS and @Grumpy_Mike... why not declare temperature as a char? Last time I checked, the temperature around here is unlikely to get above 127 degrees C or less than -128 degrees C. What on earth is the point in using an int when you don't need two bytes to store the value, you are just wasting a byte of precious RAM. Remeber folks, just because a char is called a char doesn't mean it has to be used to store a character! (Oh, and the temperature could be 'H', that would be room temperature if it were in fahrenheit: 72 degrees F is approx. 22 degrees C)

(2) The issue lies in this line:
ether.browseUrl(PSTR("/data_request?id=variableset&DeviceNum=49&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value="), temperature, website, my_callback);

You first need to convert the temperature to a string of characters before passing it to that function. For example:

Code:
char temp[5];
sprintf(temp,"%d",temperature);
ether.browseUrl(PSTR("/data_request?id=variableset&DeviceNum=49&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value="), temp, website, my_callback);
783  Using Arduino / Microcontrollers / Re: More than 256K of memory? on: February 16, 2013, 02:49:32 pm
Do you know it is going to be larger than 256K, or are you just making a wild guess? Just as an example, it is possible to make an entire MP3 player in 90k of Flash, and that was over 15000 lines of code...
784  Using Arduino / General Electronics / Re: ID this connector? on: February 16, 2013, 02:20:24 pm
JST connectors if I remember correctly.
785  Products / Arduino Due / Re: Arduino Due libraries (official and 3rd party) on: February 09, 2013, 05:54:01 am
As mentioned in this thread:
http://arduino.cc/forum/index.php/topic,136495.0.html

My gLCD-Library for Nokia 6100 Displays fully supports the arduino due. This means that the Sparkfun Color LCD Sheild is compatible with the Due.
786  Products / Arduino Due / Re: Due support for Nokia 6100 display on: February 09, 2013, 05:38:58 am
The two types of display are completely different.

One is Colour, one is B/W. One uses 9bit SPI, the other uses 8bit SPI. All of the command registers have different addresses. I you were to write your own driver code, then you could possibly reuse alot of the code from my library.
787  Using Arduino / Microcontrollers / Re: Solution to PCREL error for avr25/ATTiny84/ATTiny85/ATTiny88. on: February 05, 2013, 03:50:05 am
have you restarted the IDE?

Double check you put the ld file in this folder:
"<arduino directory>\hardware\tools\avr\avr\bin"

Did you extract the ZIP file?

Did you definitely get the Windows version (not the Mac version by accident)?



This fix definitely applies to your problem, and should work.



@fungus, you don't need the whole folder, just the ld file.
788  Products / Arduino Due / Re: Due support for Nokia 6100 display on: January 29, 2013, 03:50:22 pm
It is possible, but you would have to write the code to decode bitmaps youself.

I have done it in a previous project (displaying album art for an MP3 Player), but I never got around to cleaning up the code and posting it. Unfortunately I am rather busy with university work and won't have the time to be much help.

Bitmaps are fairly straight forward to decode. The issue is they store the pixel data in reverse (BGR with the first pixel data in the file being the last on the screen). I basically ended up having to use a large (2kB) ram array to extract and reverse the data chunk by chunk and print it to the display.

If you save the image as raw data in a PROGMEM array, then you can display it directly by calling:

graphic.Window(x1,y1,x2,y2);

to create a window on the screen, then fill it with pixels by calling:

twoPixels(red1,green1,blue1,red2,green2,blue2);

where the 6 values are 4 bits (0-F) and represent the red, green and blue data for two consecutive pixels.
789  Products / Arduino Due / Re: Due support for Nokia 6100 display on: January 27, 2013, 03:35:33 pm
The simplest way to clear the extra letters is to have a set area of the screen that you are going to print the value to, say 4 characters in this case, then pad your string with ' ' (space) until those four letters have been written. For example:
Code:
char x = 0;
char y = 0;

graphic.setCoordinate(x,y);
graphic.setFont(Normal_SolidBG);
char numSent = graphic.print("123"); //prints the number 123. The print function returns how many letters have been written, so numSent=3
char oldX = x;
x += (numSent*6); //for normal size font, each character is 6 pixels wide
while(numSent < 4){
  graphic.print(' '); //pad up to 4 characters.
  numSent++;
  x += 6;
}
x = oldX; //restore original print location.
790  Using Arduino / Programming Questions / Re: Help with bytes, ints, longs on: January 26, 2013, 01:55:50 pm
The code you wrote can equally be written in another way, using a union:
Code:
//Make a new variable type which contains an int, a long, and a 4 byte array all sharing the same memory space:
typedef union {
  byte array[4];
  long longInteger;
  int integer;
} ArrayToInt;

ArrayToInt byteArray = {68,1,0,0}; //the first object in the union declaration is a 4 byte array, so the type can be initialised as an array.
static char stringBuffer[50];

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

void loop(){
  delay(1000);
  sprintf (stringBuffer, "Long, Int, Bytes: %ld, %i, %i %i %i %i --- ;) \r\n", byteArray.longInteger, byteArray.integer, byteArray.array[0], byteArray.array[1], byteArray.array[2], byteArray.array[3]);
  Serial.print(stringBuffer);
  Serial.println();
}
791  Using Arduino / Programming Questions / Re: Help with bytes, ints, longs on: January 26, 2013, 11:47:14 am
Yup, AVRs use Little Endian, which means the following array:

{0,0,1,68}

when converted to a long becomes:

68*256^3 + 1*256^2 + 0*256^1 + 0*256^0 = 1140916224

Little endian means that the least significant byte is placed at the lowest memory address (leftmost in the array initialiser)
792  Using Arduino / Microcontrollers / Re: List of arduino compatible microcontrollers on: January 26, 2013, 09:16:42 am
Further supported mega chips:
Mega1280
Mega1284/644/324
Mega8
Mega88/168


Along with the Tiny chips you have listed, the following should work:
Tiny87/167 [I'm about to add support to my tiny core for these as I will be using them in a project]
Tiny861/461
Tiny88/48
Tiny24
Tiny25
793  Using Arduino / Microcontrollers / Re: ATTiny85 Programming Woes on: January 22, 2013, 06:18:46 pm
No harm done. We've all been there and done that at some point or other. If you never make mistakes, you can never learn, that's my motto smiley.
794  Using Arduino / Microcontrollers / Re: ATTiny85 Programming Woes on: January 21, 2013, 03:40:34 pm
If you have a multimeter or continuity tester, I would use it to make sure that the pins on the attiny are properly contacting with the adaptor you are using.
795  Using Arduino / General Electronics / Re: Difference between Arduino 5V power and output of 7805 5V power on: January 20, 2013, 11:19:45 am
Be very careful using a potentiometer to control the LED, if you turn it too far you can end up having much less resistance in series with the LED as you think = BANG.

Also know that the 10k pot may not be linear. If for example it is a log pot, then half way is not necessarily 5k, in fact it is usually only around 1k.
Pages: 1 ... 51 52 [53] 54 55 ... 116