Show Posts
Pages: 1 ... 1172 1173 [1174] 1175 1176 ... 1858
17596  Using Arduino / Programming Questions / Re: Can someone explain data type "byte" on: December 06, 2011, 09:13:58 am
Irrespective of PWM frequency, an eight bit PWM channel will be at 100% ON with a value of 255, because 255 (0b11111111 or 0xFF) is the largest number you can represent in eight bits.
A value of 128 will represent a 50% duty cycle (128/255), again, irrespective of PWM frequency.

Note, however, that perceived brightness of a LED is a log function, not linear.
17597  Using Arduino / Programming Questions / Re: Can someone explain data type "byte" on: December 06, 2011, 08:58:59 am
Presumably, the programmer is going to pass those colour component values to eight bit PWM channels, with the LED connected to each in a non-inverting manner, so {255, 0, 0} represents maximum brightness for the red channel.
17598  Using Arduino / Programming Questions / Re: arduino has main function...??? on: December 06, 2011, 08:11:34 am
Yes, there is a "main", but it isn't clear to me why you need access to it.
Code:
int main(void)
{
init();

setup();
    
for (;;)
loop();
        
return 0;
}

You provide "setup" and "loop".
17599  Using Arduino / Programming Questions / Re: Am I missing a conversion? on: December 06, 2011, 07:49:32 am
Your indentation is making my eyes bleed, and I can't line up your braces.
17600  Community / Bar Sport / Re: Crap Science on TV on: December 06, 2011, 07:40:56 am
Quote
CSI is all about coolness not science.

But, if and the much better 'Big Bang Theory' gets kids onto science courses then I'm all for it!
A few months ago, I was chatting to a lecturer in forensic science.
She said she'd seen a spike in admissions and interest in the course because of CSI and NCIS, but even among her students, there seemed to be a unrealistic expectation of high clearup rates and the hope that you'd spend your day flouncing around in Armani, rather than getting soaked in a noddy-suit in muddy fields or high-rise stairwell.
17601  Using Arduino / Programming Questions / Re: Code Help !! on: December 06, 2011, 06:51:29 am
Quote
I have a bunch of functions that call different LED colors
How do you "call" a colour?

Quote
and int C++ code it should theoretically be under stood as blueleds instead of colors by the microcontroller.
Can you review that string of words and reform it into an understandable sentence please?
17602  Using Arduino / Programming Questions / Re: Code Help !! on: December 06, 2011, 03:11:19 am
Quote
I keep getting an error,
Is it a secret?
17603  Using Arduino / Programming Questions / Re: Problem with reading string from GSM on: December 06, 2011, 02:48:28 am
You're quite right, I did miss the fact that your processor has only 8 300 instruction cycles per received character period to process the incoming data, and not 16 600.
I apologise.

I did, however notice that you'd provided a one hundred character buffer for the received data in your sketch.
17604  Using Arduino / Programming Questions / Re: Solved: coverting a concatenated string to float on: December 06, 2011, 02:42:57 am
The reason I asked if it was blocking is because if it is (and it is) the only thing that is allowing your sketch to work is the fact that you print every received character out, thus delaying your sketch long enough to allow the next character to be received.

Code:
if (mySerial.available())
This says "is there at least one character available in the receive buffer?"
And then you potentially read four of them.
You should always check to see if there is data available before reading; if you remove your debug prints, your sketch may stop working.
17605  Using Arduino / Programming Questions / Re: Problem with reading string from GSM on: December 05, 2011, 04:58:23 pm
No, really, you're misunderstanding the problem, and this kind of thing will bite you on the ass again if you don't address it.
There is no reason a 16MHz processor shouldn't be able to do this with a serial buffer of a single character at 9600 bps.
Rewriting the serial library is a sticking-plaster solution.
17606  Using Arduino / Programming Questions / Re: Float addition oddity on: December 05, 2011, 04:50:34 pm
What does your output look like? (Sorry, I'm posting from my tablet, and I'm a long way from my Arduinos)
17607  Using Arduino / Programming Questions / Re: Solved: coverting a concatenated string to float on: December 05, 2011, 04:45:56 pm
Is the software serial read blocking?
17608  Using Arduino / Programming Questions / Re: Adding a value to my array/string on: December 05, 2011, 04:39:39 pm
You're overwriting the string terminator.
If you overwrite with zero, no big deal, but any non zero value is going to screw strlen.

That code looks nothing like what you posted first - please remember to post what you're using, otherwise it just wastes time.
17609  Using Arduino / Programming Questions / Re: Adding a value to my array/string on: December 05, 2011, 04:20:55 pm
You could post all your code, as it compiles right now.
17610  Using Arduino / Programming Questions / Re: Changing pps on arduino mega 2560 on: December 05, 2011, 04:13:15 pm
You talk to digital servos the same way you talk to analogue servos, with 50Hz PPM.

You may want to see if your for loops agree with their comments.  smiley-wink
Pages: 1 ... 1172 1173 [1174] 1175 1176 ... 1858