Show Posts
Pages: 1 ... 50 51 [52] 53 54 ... 115
766  Using Arduino / Microcontrollers / Re: atMega1284P-AU @ 20Mhz on: March 17, 2013, 06:09:40 am
The full swing would be better for noisy environments, but it also consumes more power. I found that the low power crystal oscillator worked fine in my project, though I didn't try it on breadboard, the circuit was built directly onto a PCB. I imagine with a breadboard there will be much more noise and so the full swing setting could be useful.

The brownout probably should be 4.3V, or not on at all, however the powersupply I was using at the time was rather crappy and kept triggering the brownout - the circuit drew large currents at times and the supply couldn't hold its voltage, dropping on occasion to around 4v. The chip still worked fine at 4V, but that is outside the guaranteed working region.
767  Using Arduino / Project Guidance / Re: ABC - Arduino Basic Connections on: March 16, 2013, 09:13:09 am
For the 'Pushbutton to 12V', you have a note under it that says that for 24v you should increase R to 2200 Ohms. You don't however mention which resistor to increase as there are two. While to the more experienced it is obviuos which you mean, for those who are new to electronics, it is asking for trouble, as increasing the bottom one would result in 16.5V across the arduino.

The other thing is that you may want to check your 'Encoder' circuit. As it is there is nothing in the circuit to generate a logic 1, unless you are using 0v logic smiley-wink.

Other than that, looking good.
768  Using Arduino / Programming Questions / Re: LED navigation lights can someone help me modify this code on: March 11, 2013, 03:36:18 pm
One thing is this:
 if (ledState == LOW)
    ledState = HIGH;
    ledState = LOW;

First of all, never use if statments without {}. Yes it is valid for a single line, but it makes code difficult to follow and allows mistakes to creep in.

Secondly, that snippet of code can be replaced with just:

ledState = !ledState;
769  Using Arduino / Programming Questions / Re: Faking SPI with Attiny85 on: March 06, 2013, 08:07:50 am
The lines of code for USI aren't buying time so much as they are performing a function. To do SPI with the USI module you have to generate the clock cycles manually by writing to the config register - not only that but you have to manually do every edge, so for an 8bit transfer you have to perform 16 writes to the config register.
If you just put 16 instructions in a line, you can get a clock rate of Fcpu/2, if you use a loop, that drops to Fcpu/6.
You will have to edit USI.h to provide the correct Arduino pin numbers corresponding to the USI pin locations. There are three #defines at the top of the .h file which set this.

[USI library attached]

For the software library, you can use any of the 4 SPI modes, and have a choice over data order. Due to the way it is generated, the fastest speed I could get was 1/16th of the clock frequency.
With the software library you have to specify which pins to use for SPI in the begin call:
begin(byte SCK_, byte MOSI_, byte MISO_, byte SS_)
There is also a function which allows you to set the state of the SS pin:
void writeSS(boolean state);

[TinySoftwareSPI attached]
770  Using Arduino / Programming Questions / Re: Faking SPI with Attiny85 on: March 05, 2013, 06:27:27 pm
I have written a drop in replacement library for SPI. I have both a USI Master version and a bitbanged software Master version. If you would like I can upload them.
771  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).
772  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:

char temp[5];
ether.browseUrl(PSTR("/data_request?id=variableset&DeviceNum=49&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value="), temp, website, my_callback);
773  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...
774  Using Arduino / General Electronics / Re: ID this connector? on: February 16, 2013, 02:20:24 pm
JST connectors if I remember correctly.
775  Products / Arduino Due / Re: Arduino Due libraries (official and 3rd party) on: February 09, 2013, 05:54:01 am
As mentioned in this thread:,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.
776  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.
777  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.
778  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:


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


where the 6 values are 4 bits (0-F) and represent the red, green and blue data for two consecutive pixels.
779  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:
char x = 0;
char y = 0;

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.
  x += 6;
x = oldX; //restore original print location.
780  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:
//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(){

void loop(){
  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]);
Pages: 1 ... 50 51 [52] 53 54 ... 115