Show Posts
Pages: 1 ... 1889 1890 [1891] 1892 1893 ... 3334
28351  Using Arduino / Programming Questions / Re: Evaluating PID algorithm on: April 17, 2012, 01:52:06 pm
Quote
My code issue is in the functions processSteer, processWheel, and setSteer.
And yet there is not a Serial.print() statement in site. If you expect us to debug this for you, you'll need to send one of us the hardware. PM me if you need a shipping address.
28352  Using Arduino / Programming Questions / Re: ATtiny! Damn that thing is tricky on: April 17, 2012, 01:32:28 pm
Quote
I think the problem is I didn't turn off the auto-reset, and I don't know how.
You don't get to "turn off the auto-reset". The capacitor absorbs the reset signal before it has an opportunity to reset the board. The wrong size capacitor charges up too fast, and allows the signal to reset the board. A larger one, as you are using, should be better than a smaller one, but, the right size one is cheap.
28353  Using Arduino / Programming Questions / Re: Can libraries be used like this? on: April 17, 2012, 01:29:05 pm
Be aware that "do the LED pattern" does NOT mean using delay(). Period. No delay()s. Period. Full stop.
28354  Using Arduino / Programming Questions / Re: Servo coding on: April 17, 2012, 01:27:32 pm
It's a lot easier, in my opinion, to see the structure of your code if you put each and every { and } on its own line and use Tools + Auto format to properly indent the code.

You can easily see useless curly braces (you have several) and missing braces.

Code:
{
   if (digitalRead(3) == LOW)
      myservo.write(pos);
   delay(15);
   Serial.println("Current Angle");
   Serial.print(pos);
   lcd.print(pos);
   delay(100);
   lcd.clear();
}
clearly doesn't look like I think you expect it to look.
28355  Using Arduino / Programming Questions / Re: RGB wifi controller on: April 17, 2012, 11:43:11 am
Quote
ideally i would like an app on my android but i have no idea how to even start with a android app.
Maybe you should ask at the Chevy dealer. We work on Fords here.
28356  Using Arduino / Programming Questions / Re: RGB with FSR on: April 17, 2012, 11:38:22 am
Quote
Might be a stupid question but what are debug prints ?
Code:
Serial.println(val);  //diagnostic printout
28357  Using Arduino / Programming Questions / Re: RGB with FSR on: April 17, 2012, 10:45:17 am
Code:
if(inB <= 340)                // BLUE LED
 B = 0;
 if(inB > 340 && inB <= 510)
 B = map(inB, 341, 510, 0, 255);
 if(inB > 510 && inB <= 850)
 B = 255;
 if(inB > 850)
 B = map(inB, 851, 1023, 255, 0);
You're missing a bunch of elses.

Code:
Serial.println(val);  //diagnostic printout
Why aren't you printing R, G, and B, too?
28358  Using Arduino / Programming Questions / Re: Switching MIDI CC outputs on: April 17, 2012, 10:41:35 am
Code:
int buttonState;           // The previous state of the button recorded here
int val;                       // the current value of the button
You might as well start now with meaningful names. Something like currState and prevState would make a whole lot more sense.

Code:
int notePin = (7);
int modePin = (8);
Parentheses look silly here. They are not needed.

Code:
Bounce button1 = Bounce(7, 5);
Bounce button2 = Bounce(8, 5); 
You gave the pins names. Use them.

Code:
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
Ditto.

Code:
{                                          //if mode is 0, the analog value (/8) is sent out as a CC 74, otherwise as a 75
That curly brace, and one somewhere later are not needed. Get rid of them.

Code:
    if (val == HIGH)                   // if it's ON, then increment the mode value. Otherwise, decrement it.
    {
      mode++;
    }else{
      mode--;
    }
You want mode to have one of two values, 0 or 1, what's with the increment and decrement. Lose them, and just assign the value you want mode to have. It actually looks like you want mode to have the value of val, regardless of what val is.
28359  Using Arduino / Programming Questions / Re: Datafile.print: Print string problem on: April 17, 2012, 10:27:13 am
Quote
For testing mine time. I erase every "serial.print" except "Serial.println(Tijd)". This will print the time that mine program is working in msec. And than is just a subtraction.
That counts, then, the time to open and close the file.

Can you determine (or even guess) what takes the most time?
28360  Using Arduino / Programming Questions / Re: Salt Reef seasons IF Then Confusion!? on: April 17, 2012, 10:25:31 am
Quote
I thought that arduino was written with c language not c++ persay.
No. It is C++ all the way. Since C++ is a superset of C, you get all of C, warts and all, along with it.
28361  Using Arduino / Programming Questions / Re: initalize a constructor in a class. on: April 17, 2012, 10:14:10 am
You can't instance the Twitter object in the header file, with arguments, because doing so needs to execute code, and you can't do that in a class header file. You can only have executable code in a class implementation file.

There's no reason why the twit that designed that class needed to make the constructor require an argument. The constructor itself doesn't DO anything with the token except point to it. That could have been done with a begin/init method.
28362  Using Arduino / Project Guidance / Re: SM5100B shield with UNO R2 & (IDE 1.0) on: April 17, 2012, 08:45:59 am
Too bad it's not complete.
28363  Using Arduino / Project Guidance / Re: RSSI Reading Signal Strength With Arduino and XBee on: April 17, 2012, 08:35:54 am
Quote
I want the RSSI data to be shown on my computer.
Why?

Quote
The problem is that I can't run my code that shows the incoming data on my Computer when I have the XBee connected to the Arduino because I have to remove the microcontroller when using XBee.
Sniff. Sniff. I think you stepped in something that smells a lot like bullshit.

Ditch try to talk to the XBee using X-CTU and just open the Serial Monitor.
28364  Using Arduino / Programming Questions / Re: Datafile.print: Print string problem on: April 17, 2012, 08:29:46 am
Quote
But do you have tips or tricks to what type I best declare my variables or convert them. So i can put them together  in one string so i just need one or 2 "datafile.print".
You can create a character array, and use sprintf() to populate that array with all kinds of data.

Quote
The void loop is now 40 ms and only for "datafile.print" need i 30ms. For the moment is this to long.
How did you measure this? Why is keeping the write time under 30ms important when you have this:
Code:
  delay (1000); //1000ms
And does that comment contribute anything?
28365  Using Arduino / Programming Questions / Re: initalize a constructor in a constructor. on: April 17, 2012, 08:15:34 am
Quote
Do you have any idea on how to call it?
Yes. And, if you post some real code, I'll tell you. Depends on your real code, though.
Pages: 1 ... 1889 1890 [1891] 1892 1893 ... 3334