Show Posts
Pages: 1 ... 17 18 [19] 20 21 ... 285
271  Using Arduino / Programming Questions / Re: Strange Interrupt Behaviour on attach on: July 16, 2014, 07:11:53 am
Code:
attachInterrupt(1, vibration1, FALLING); //doesn't work. Triggers interrupt routine instead.
Quote
This is a strange comment. I always thought the purpose of attachInterrupt was to trigger an interrupt routine.
Surely the act of attaching the interrupt should not actually trigger it though, merely make it possible to trigger the interrupt when the interrupt pin state changes.
272  Using Arduino / Programming Questions / Re: #define, int or const int on: July 16, 2014, 04:47:07 am
Note that
Code:
#define ledPin = 13
is not correct.  Unless, that is, you really want the pre-processor to replace all instances of ledPin with = 13, which is unlikely
273  Using Arduino / Programming Questions / Re: Game of Life generation not being pushed to 16x32 LED matrix on: July 16, 2014, 03:01:14 am
Which Arduino are you using ?

I have not looked at your code in detail but you have 2 arrays of booleans, each 18 by 34.  That is going to take over 1200 bytes so you may have a problem with lack of memory.

It would be much more efficient in terms of space to pack the data into bits rather than bytes.
274  Using Arduino / Programming Questions / Re: Programme stuck in setup on: July 15, 2014, 12:36:08 pm
Define what you mean by more powerful

More memory ?
Faster processor ?
More pins ?
More than one hardware serial port ?
etc, etc
275  Using Arduino / Programming Questions / Re: Programme stuck in setup on: July 15, 2014, 11:14:30 am
My best guess would be that you are running out of memory which will not be helped by the extensive use of String objects as opposed to C style strings.  As a first test reduce the length of hdrstr to a single character.  Do you get any different results ?
276  Using Arduino / Programming Questions / Re: Problem with 433Mhz rf link code on: July 15, 2014, 11:06:24 am
Code:
Serial.print((char)buf[i]);
277  Using Arduino / Programming Questions / Re: Problem with 433Mhz rf link code on: July 15, 2014, 07:55:51 am
You are getting the Hex value of the ASCII code for the letters.  No surprise really when you print the data using
Code:
    Serial.print(buf[i], HEX);
from a buffer defined as being an int rather than a char.
Code:
    uint8_t buf[VW_MAX_MESSAGE_LEN];
278  Using Arduino / Programming Questions / Re: Strange Interrupt Behaviour on attach on: July 15, 2014, 07:26:27 am
Code:
void vibration1() {
  vibration1Timer = millis();
  detachInterrupt(1);
}
Interrupts are automatically disabled when an ISR is triggered and enabled when the ISR has run.  The latter may be causing interrupts to be enabled at the end of the ISR.

Quote
The full sketch is quite long and take about 2 seconds to go through the loop
What is it that causes it to take 2 seconds each time through the loop() function ?

Without seeing what else your program does it is difficult to tell, but it is quite possible that you do not need to use an interrupt at all.
279  Using Arduino / Programming Questions / Re: who can tell me the "word" function defined in which library file? on: July 15, 2014, 06:00:33 am
If you can explain why you need to copy the function it may be possible that you do not need to do it ?
280  Using Arduino / Programming Questions / Re: another way of writing a counter on: July 14, 2014, 05:00:42 pm
It would help considerably if you would post your whole program and describe what you are trying to achieve.  The snippet of code posted is a waste of time without seeing it in context of the whole program.
281  Using Arduino / Programming Questions / Re: fireworks firing system 64 cue + on: July 14, 2014, 10:45:48 am
Your first task should be to post your existing code again but this time use code tags to avoid a large portion of it being turned into italics and destroying the array index when you use the variable i.

Your second task should be to post the new code that you have tried, again in code tags, and a description of what should happen when it runs, what actually happens when it runs and if it will not compile, what error messages you get.
282  Using Arduino / Programming Questions / Re: Read integer from multiple integers string on: July 14, 2014, 10:36:12 am
Quote
UKHeliBob made a small typo
Good spot Robin.

Now, of course, using Google you can search for the atio() function and find my post !
283  Using Arduino / Programming Questions / Re: Read integer from multiple integers string on: July 14, 2014, 06:05:12 am
Method 1 : Read the whole input into a string (Note NOT a String) then use the strtok() function to extract the piece that you want, delimited by semi-colons, then use the the atio() function to turn it into an integer.

Method 2 :Read the bytes as they arrive, count the semi-colons so that you know where you are and save the bytes that you want in a char array terminated by a null to turn it into a string, then use the the atio() function to turn it into an integer.
284  Using Arduino / Programming Questions / Re: GPIO help on: July 14, 2014, 02:46:43 am
Quote
I'm still wondering if the arduino uno can manage 12 separate inputs and 12 separate outputs.. It looks like there are less than 24GPIO pins on it.
Which Arduino are you looking at ?
The Uno has 20 input/output pins whereas the Mega has 70.
285  Using Arduino / Programming Questions / Re: Help me please position control motor code on: July 13, 2014, 11:06:32 am
You don't actually say what problem you have.

One thing I noticed are lines like this
Code:
    long error = (encoder0Pos*0.72) - target ;
and
Code:
volatile long encoder0Pos = 0;
The error and encoder0Pos variables are declared as a long which implies that their value could be between -2,147,483,648 and 2,147,483,647.  Do you need such large numbers ?

Also, in the first example line above you multiply encoder0Pos by 0.72 and put the result in a long integer, not a float.  This may not matter but it is probably not doing exactly what you think.
Pages: 1 ... 17 18 [19] 20 21 ... 285