|
785
|
Using Arduino / Programming Questions / Re: DC motor Steering control through POT
|
on: January 15, 2012, 05:16:43 pm
|
It's pretty difficult if you want to do it right - look up PID. Of course, you can try to simplify it - just take the value of the pot, subtract where you want to go from it, and then move the motor at a speed proportional to that. (that's a P loop in PID terms) // Set this value by trial and error - if it doesn't get to where you want it to go, increase it; if it oscillates after getting where you want it to go, lower it; if both (or you can't find a happy medium) you'll need to look into using the I and D terms of PID int Pterm; // 0 to 1000 int dest; // where you want the steering to go int pos = analogRead(potpin); int speed = (((long)pos - (long)dest) * (long)Pterm)/1000;
// Run your motor at the right speed.
|
|
|
|
|
786
|
Using Arduino / Installation & Troubleshooting / Re: lilypad onboard led doesn't flash
|
on: January 14, 2012, 12:42:46 am
|
|
Stupid question, but did you try disconnecting and reconnecting it? What LED are you talking about? The power one shouldn't flash, and a solid Tx LED (if it exists on a lilypad; I'm not sure) is some sort of error. I usually fix it (on linux) by holding down the reset button until it's ready to upload. Release the reset button when the Rx LED flashes once.
|
|
|
|
|
789
|
Using Arduino / Installation & Troubleshooting / Re: pin 13 doesn't seem to have any power?
|
on: January 14, 2012, 12:35:48 am
|
thanks; that would be great.
by the way, when you say the serial won't work, do you mean that IF I connected those pins then it would be DAMAGED?
No, since one is an input and one is an output. If you connected to output pins, one driven HIGH and one driven LOW, you'd likely break something. Actually, connecting the two serial pins together is a fine way to test the serial code. Just do a serial.write('a'); and then serial.read(); and hope you get 'a' back (but it's hard to see since you can't send anything to your computer!)
|
|
|
|
|
790
|
Using Arduino / Programming Questions / Re: learning c
|
on: January 13, 2012, 11:19:14 pm
|
what dose it mean when i see <servo.h> or <stepper.h> are these files i need to have are dose the arduino already know.thanks
The preprocessor code "#include" takes the file specified and copy-and-pastes it in place of the #include. The preprocessor knows several places to look by default, then the Arduino IDE adds some more when it calls the preprocessor. Using angle brackets (like <servo.h>) means just look in those directory specified, and using quotes (like "myfile.h") looks in the same directory as your file being compiled first. For if you need to get them, try compiling the code. If it compiles, great; you have them. If not, scroll up to the first (most useful) error message. If it says "cannot find stepper.h" then find a place to download it from and put it in your sketchbook, under a directory called "libraries"
|
|
|
|
|
793
|
Using Arduino / Programming Questions / Re: Programming LoL Shield
|
on: January 12, 2012, 01:16:19 am
|
I count myself as a 3rd... Someone mentioned in another forum post I started, http://arduino.cc/forum/index.php/topic,84777.0.html, mentioned putting an #include <Arduino.h> at the top of the LOLShield library file (I'm assuming they meant lolshield.h) and it clears-up some of the problems, but I still get the error: C:\Program Files (x86)\arduino-1.0\libraries\LoLShield\Charliplexing.cpp:31:22: error: WProgram.h: No such file or directory Apparently there is a inconsistency between the libraries of older versions of the IDE, and 1.0, which Jimmie Rodgers needs to update in his code, or somehow they need to be transfused from a previous version of the IDE, into the new version. You have to REPLACE WProgram.h with Arduino.h, among other possible things.
|
|
|
|
|
795
|
Using Arduino / Programming Questions / Re: PROGMEM and Serial
|
on: January 07, 2012, 09:14:25 pm
|
You can't. You can make a normal PROGMEM array and define your own print function, like this: void printProgmemArray(prog_uchar* array, byte length) { for (int i = 0; i < length; i++) { Serial.print(array); Serial.print(", "); if (i % 10 == 0) Serial.println(); } Serial.println(); }
|
|
|
|
|