Show Posts
Pages: 1 [2] 3 4 ... 116
16  Using Arduino / Programming Questions / Re: Problem when storing result of multiplication as a "long" variable on: September 26, 2014, 01:30:08 pm
That isn't the whole story. The product of two integers (16-bits on Arduino) is defined in the C language to also be an integer - not a long (32-bit) - so you have to cast one or both integers to be a long (32-bit) so that the result of the multiplication is long.

Pete
17  Community / Website and Forum / Re: Website problems 25/26 Sept 2014 ??? on: September 26, 2014, 09:35:06 am
For about a month now I've been experiencing problems with occasional very sluggish response when I go to a forum page. E.g. when I have read an index page and click to return to the main forums page it can take up to a minute to respond, or it can respond immediately. Annoying.

Pete
18  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino Support package for MATLAB R2014a on: September 26, 2014, 09:28:52 am
There's no need to change it if it is already at 115200. At that speed you can transfer nearly 300 characters in 25ms. Either the Matlab protocol is really wasteful or something else is slowing things down.
I think you're going to have to ask here:
http://www.mathworks.com/matlabcentral/answers/?term=arduino

Pete
19  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino Support package for MATLAB R2014a on: September 25, 2014, 07:26:27 pm
You probably need to increase the baud rate between Arduino and Matlab. I'm guessing that you're using 9600. Try increasing that to 57600 or 115200.

Pete
20  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino Support package for MATLAB R2014a on: September 25, 2014, 03:25:00 pm
Have you loaded the Matlab support package into the Arduino?

Pete
21  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino Support package for MATLAB R2014a on: September 25, 2014, 02:55:26 pm
You should try getting help here:
http://www.mathworks.com/matlabcentral/answers/?term=arduino

Pete
22  Using Arduino / Programming Questions / Re: Question regarding if functions alternating on: September 25, 2014, 02:46:11 pm
Don't crosspost a question you've already posted, and had an answer, in the German forums.

Pete
23  Using Arduino / Programming Questions / Re: Using the pow() function?? on: September 24, 2014, 07:36:00 pm
I don't think you need an exponential mapping function. A simple quadratic might work well. The function y = 3*x*x/100 will map the input range of 0-255 to an output range of 0-1950 (close enough to 2000?). The multiplies are done using long integers to avoid overflow problems. This code tests the function:
Code:
uint16_t my_map(uint16_t pot_value)
{
  return(3L*pot_value*pot_value/100L);
}

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

  Serial.println(my_map(0));
  Serial.println(my_map(1));
  Serial.println(my_map(10));
  Serial.println(my_map(100));
  Serial.println(my_map(200));
  Serial.println(my_map(255));
}

void loop(void)
{
}
and prints:
Code:
0
0
3
300
1200
1950

Pete
24  Using Arduino / Programming Questions / Re: can someone help me? with my code on: September 24, 2014, 11:23:45 am
Read How to post code properly and then fix up your message with [code] [/code] tags.

Pete
25  Using Arduino / Displays / Re: Problem with I2Cscanner on: September 23, 2014, 01:53:07 pm
Does it work without the pullup resistors?
If not, what resistors do you have? You might be able to put some in series and/or parallel to get a resistance near 4.7k.

Pete
26  Using Arduino / Displays / Re: Problem with I2Cscanner on: September 23, 2014, 01:30:32 pm
I can't see the colours on those resistors clearly but I think they are 200 or maybe 270. They should be about 4.7k.

Pete
27  Using Arduino / Programming Questions / Re: DS1822: How does the program assign the sensor's index? on: September 22, 2014, 09:40:20 pm
The OneWire bus software will enumerate the devices in numerical order. However, the numerical order isn't quite what you'd expect. For example when I run a sketch to identify two DS18B20s it finds them in this order:
Code:
ROM = 28 D4 C9  0  4  0  0 49
ROM = 28 1E BD  0  4  0  0 6B

Looks like it has got them reversed but when it enumerates them, it checks each byte of the address low order bit first.
The two addresses obviously differ in the second byte. Writing the bits out and then reversing them:

Code:
   normal    reversed
D4=11010100  00101011=2B
1E=00011110  01111000=78
When the address is rewritten with the bits in the order that the enumeration protocol does it, you can see that what we write as 'd4' is seen as '2B' by the enumeration software.

So, the answer is that the devices are indexed in numerical order of address with the low order bits of each address byte checked first.

Pete
28  Using Arduino / Programming Questions / Re: loops / for /while/ect on: September 22, 2014, 08:34:43 pm
Indeed. Missed the obvious :-)

Pete
29  Using Arduino / Programming Questions / Re: loops / for /while/ect on: September 22, 2014, 07:11:25 pm
And, presumably, you put that code in the loop() function which is executed over and over, forever and anon.
If you want to stop your code executing just add
while(1);
at the end.

Pete
P.S. it is etc. - not ect.
30  Using Arduino / Programming Questions / Re: Morse Code lights problem with delay and organization on: September 22, 2014, 03:58:40 pm
You are supposed to use code tags. Read How to post code properly
and fix up your first post otherwise I, for one, won't help.

Pete
Pages: 1 [2] 3 4 ... 116