Show Posts
Pages: 1 ... 90 91 [92] 93 94 ... 209
1366  Using Arduino / Programming Questions / Re: Program game does not work on chip, whats wrong with program on: May 02, 2013, 10:01:01 pm
I just created an account today I don't now how to post it in code format

Then perhaps your should review the thread at the top entitled "How to use this forum - please read"
1367  Using Arduino / Programming Questions / Re: Multiple things at once (millis) on: May 02, 2013, 09:45:08 pm
Code:
if (digitalRead (STBY) == LOW)
  {
    digitalWrite (STBY, HIGH);
    digitalWrite(AIN1, LOW);  //FORWARD  ****
    digitalWrite(AIN2, HIGH);    //REVERSE IF HIGH
    analogWrite(PWMA,255);
    digitalWrite(BIN1, LOW);  //FORWARD
    digitalWrite(BIN2,HIGH);  //REVERSE IF HIGH
    analogWrite(PWMB,255);
  }
Aside from STBY, none of the other digital or pwm outputs handled in this if statement change outside of it, so you could acheive the same thing by moving the last 6 statements into setup(). Is that your intention?
1368  Using Arduino / Programming Questions / Re: Program game does not work on chip, whats wrong with program on: May 02, 2013, 09:37:06 pm
this is the revised version any problems you see?

Not posted with code tags, and no use of the auto format tool to fix the complete lack of indenting.
1369  Using Arduino / Programming Questions / Re: Program game does not work on chip, whats wrong with program on: May 02, 2013, 08:36:24 pm
my teacher told me that you cannot digital read  a pin set to ouput smiley-eek

If your teacher meant it will not work, then he's wrong.
1370  Using Arduino / Programming Questions / Re: Sous Vide Programming help (90% done) on: May 02, 2013, 08:25:08 pm
Code:
  if (buffer <= 0) {}
If buffer is less than or equal to 0, do nothing. You may as well remove the line as its not doing anything for you.

Code:
   { if ( targetTemp > celsius ) {
      digitalWrite(12, LOW);    // set the relay OFF
    }
    else {
      digitalWrite(12, HIGH);   // set the RELAY ON
    }}

The outer most brackets in this block are pointless, may as well remove them.
1371  Using Arduino / Programming Questions / Re: Sous Vide Programming help (90% done) on: May 02, 2013, 05:43:33 pm
Code:
  if (buffer <= 0) {
    ...
    if ( targetTemp > celsius ) {
      digitalWrite(12, LOW);    // set the relay OFF
    }
    else {
      digitalWrite(12, HIGH);   // set the RELAY ON
    }

  }

Why is changing the state of the relay contingent upon buffer being less than or equal to 0?
1372  Using Arduino / Programming Questions / Re: problem with serial.print on: May 02, 2013, 05:07:16 pm
is there any instructions for how to do that?

"Flags" are just a conceptional use of variables:

Code:
int myFlag = 0;

if (something happened)
  myFlag = 1; // set flag

...

if (flag == 1) // flag is set
{
  // do something
  flag = 0; // clear the flag
}
1373  Using Arduino / Programming Questions / Re: Parsing a string (badly) on: May 02, 2013, 05:01:50 pm
Ok guys, here's a cut-out-n-keep example of a working (actually, failing) sketch. Just paste it and upload it to see what I'm going on about.....

http://www.cplusplus.com/reference/cstring/strncpy/

Quote
No null-character is implicitly appended at the end of destination if source is longer than num. Thus, in this case, destination shall not be considered a null terminated C string (reading it as such would overflow).

You need be explicitly null terminating the strings after the strncpy().
1374  Using Arduino / Programming Questions / Re: Incrementation of number on: May 02, 2013, 03:51:02 pm
Code:
int pas = 1;

This is the only place you ever assign pas a value. That means pas will always be 1, so this line here:

Code:
freq=freq+(pas*i);

Can be reduced to this:

Code:
freq=freq+i;

Furthermore, in a for loop, it's rarely a good idea to set the value of i like you've done here:

Code:
if (freq >20)
      { i=1;
      }

What exactly are you expecting from this statement?

Code:
  break ;
1375  Using Arduino / Programming Questions / Re: A simple question about entering data via the Serial connection on: May 01, 2013, 04:14:55 pm
Sorry, I did not post any code because I didn't have any code that even came close to working for this.
That shouldn't stop you. Posting code gives us an idea of your thought process on how you are approaching this problem. This allows us to correct misconceptions that help you develop the code.
Quote
I don't suppose it's included in some sort of library somewhere, is it?
It's included within stdlib, which is included in every sketch automatically by the IDE.
1376  Using Arduino / Project Guidance / Re: Tennis Ball Machine with Remote on: May 01, 2013, 04:05:14 pm
Any suggestions on what is the minimum Arduino hardware I need to pull this off?

Nothing in your requirements suggests you would need anything more (or less) than an Uno.
1377  Using Arduino / Programming Questions / Re: Can Arduino write to a text file and store in its RAM? on: May 01, 2013, 04:03:16 pm
I'm Planing to use external memory.

But you're not going to tell us which external memory that is, nor are you going to give us a link to the device you want to display this bitmap on?
1378  Using Arduino / Programming Questions / Re: Can Arduino write to a text file and store in its RAM? on: May 01, 2013, 03:59:58 pm
38KB

The Uno has 2K SRAM.

The Mega has 8K SRAM.

So are you rocking the Due?
1379  Using Arduino / Programming Questions / Re: A simple question about entering data via the Serial connection on: May 01, 2013, 03:51:06 pm
Quote
Am I doing something wrong with this? 

Yes, but since you chose not to post any code, what you've done wrong is a mystery and I can only offer general advice.

Store the input into an array of chars. Then null-terminate it and pass it to atoi().
1380  Using Arduino / Programming Questions / Re: Connecting 3.3v directly to analog pin on: May 01, 2013, 02:16:40 pm
Floating pin Syndrome.

When a pin is not connected to anything, what do you expect it to read? Google "pull-up resistor".
Pages: 1 ... 90 91 [92] 93 94 ... 209