Show Posts
Pages: 1 ... 14 15 [16] 17 18
226  Using Arduino / Programming Questions / Re: Difference between g_register and register? on: March 13, 2012, 01:56:01 am
C++ and Java programmer...
He is undergraduate in Bachelor of Computing....
227  Using Arduino / Programming Questions / Re: Difference between g_register and register? on: March 13, 2012, 01:10:54 am
I am making a counter to count the amount of cable production...
the counter display is 3 lines of 7segment...each lines contain 4 7seg,means maximum to 9999...
I hope it helps....
228  Using Arduino / Programming Questions / Re: Difference between g_register and register? on: March 12, 2012, 10:57:29 pm
it's very long if I should explain what the simulation is all about...
Hmmm, how I could explain this....

I am using PROTEUS ISIS for the arduino simulation...
229  Using Arduino / Programming Questions / Difference between g_register and register? on: March 12, 2012, 10:38:05 pm
I am doing my project and it doesn't work in the simulation...
I found it might be caused by g_register and register...
A programmer said that g means global, is it right?

Could anyone give me example?

Thanks a lot! smiley-yell
230  Using Arduino / Programming Questions / Re: How to know the inside Arduino IDE language? on: March 12, 2012, 09:29:06 pm
Wooo hooo I got it...
I'm using Windows XP SP2 anw...
So now I know how to the code communicate using C...
Anw, the C code is difficult to understand, it is easier directly know what the Arduino IDE language..

Many thanks!
231  Using Arduino / Programming Questions / Re: How to know the inside Arduino IDE language? on: March 12, 2012, 09:13:10 pm
Hmmm well I slightly mistaken said 'box'...
Yeah since it is open source so all is open...

But in C++ I never found digitalwrite, randomSeed, etc...
Could you help me how I understand the function (digitalwrite,etc) in the place you state before :install path/hardware/arduino/cores/arduino/?
232  Using Arduino / Programming Questions / Re: About randomSeed(analogRead(0)) on: March 12, 2012, 09:06:41 pm
.....the function call random() runs an algorithm that creates a pseudo-random value based on a seed.

Since reading analogRead(0) would be an effectively random value, this effectively, gives you a random seed.

Thank you for the reply.

what do you mean pseudo-random?
why you state that analogRead(0) would be an effectively random value? How to know that?

 
233  Using Arduino / Programming Questions / How to know the inside Arduino IDE language? on: March 12, 2012, 08:58:02 pm
So far I have talked to many IT programmer that this Arduino programming using C++ language...
And they said that yes it uses C++ but using Arduino IDE so it put into 'boxes'...

For example: they never found 'digitalwrite' in C++, but it is found here...
 
I wonder how I open the box so I can get the pure C++ language, anyone could help me?

I hope you could understand what I'm trying to say, dont hesitate to reply/

Thank you smiley-grin
234  Using Arduino / Programming Questions / About randomSeed(analogRead(0)) on: March 12, 2012, 08:53:36 pm
Anyone could explain what randomSeed is and why analogRead(0)?
I have read the codesheet, but I havent understood, due to lack of example...

Thank you smiley-grin
235  Using Arduino / Programming Questions / Re: void pointers * something on: March 08, 2012, 11:51:46 pm
Anw, I am learning the code from here, I am trying to understand so I ask the forum.
http://www.cplusplus.com/doc/tutorial/pointers/
236  Using Arduino / Programming Questions / Re: void pointers * something on: March 06, 2012, 04:13:38 am
This part is clear for me...
I just think it is not equivalent with this:

*p = *q;
++p;
++q;

here,
1.get the value of q
2. equal it to the value p get
3. the address pointed by p is increased
4. the address pointed by q is increased

if so, it will not give equivalent result as above one.
237  Using Arduino / Programming Questions / Re: void pointers * something on: March 06, 2012, 03:43:06 am
I'm trying to digest it,because I also see there is void* data...hmmm

How about this:

Quote
If we write:
*p++ = *q++;
Because ++ has a higher precedence than *, both p and q are increased, but because both increase operators (++) are used as postfix and not prefix, the value assigned to *p is *q before both p and q are increased. And then both are increased. It would be roughly equivalent to:
*p = *q;
++p;
++q;
Like always, I recommend you to use parentheses () in order to avoid unexpected results and to give more legibility to the code.

I dont really get the equivalence between that two..
Could someone help me?
238  Using Arduino / Programming Questions / void pointers * something on: March 06, 2012, 03:16:03 am
I am studying about pointer for my arduino project sake, and I found confusion here:
http://www.cplusplus.com/doc/tutorial/pointers/

Code:
#include <iostream>
using namespace std;

void increase (void* data, int psize)
{
  if ( psize == sizeof(char) )
  { char* pchar; pchar=(char*)data; ++(*pchar); }
  else if (psize == sizeof(int) )
  { int* pint; pint=(int*)data; ++(*pint); }
}

int main ()
{
  char a = 'x';
  int b = 1602;
  increase (&a,sizeof(a));
  increase (&b,sizeof(b));
  cout << a << ", " << b << endl;
  return 0;
}

what does it mean pchar=(char*)data; ?
239  Using Arduino / Programming Questions / Re: "Return" question on: March 05, 2012, 11:35:07 pm
what's wrong with my modifying code so I can return:

Code:
void blinks(int a)
  {
  int a = random (1,3);
  if (a==1)
    {
    digitalWrite(9, HIGH);   // set the LED on
    return;
    }
  else
    {
    digitalWrite(9, LOW);    // set the LED off
    blinks(int a);
    }
}

it appears warning message:

Code:
sketch_mar06b.cpp: In function 'void loop()':
sketch_mar06b:2: error: too few arguments to function 'void blinks(int)'
sketch_mar06b:119: error: at this point in file
sketch_mar06b.cpp: In function 'void blinks(int)':
sketch_mar06b:127: error: declaration of 'int a' shadows a parameter
sketch_mar06b:136: error: expected primary-expression before 'int'
240  Using Arduino / Programming Questions / Re: "Return" question on: March 05, 2012, 10:58:46 pm
So according to that BASIC code, do I need to use "return" in my IDE arduino?
Or we have other way?
Pages: 1 ... 14 15 [16] 17 18