Loading...
  Show Posts
Pages: 1 ... 51 52 [53] 54 55 ... 68
781  Using Arduino / Programming Questions / Re: detect falling object with infra red (urgent) on: January 18, 2012, 04:19:25 pm
I'm not sure if using an ISR is necessary if you need to get it done quickly, but try looking up direct port access. It's many times faster than digitalRead.

I'm also questioning how you managed to get a good digitalread value on an analog signal, but that's great if it works.
782  Using Arduino / Programming Questions / Re: LiquidCrystal595 help on: January 18, 2012, 02:41:16 am
go to C:\Users\Grant\Desktop\arduino-1.0\libraries\LiquidCrystal595/LiquidCrystal595.h on line 98, and change "void" to "size_t"
783  Using Arduino / Installation & Troubleshooting / Re: Trying to interact with Arduino on Ubuntu on: January 15, 2012, 05:38:10 pm
What's the error message you get when it doesn't work? It shows up as ACM on my computer. You could try looking in /etc/udev for how linux mounts things.
784  Using Arduino / Programming Questions / Re: Where do I find cpp source? on: January 15, 2012, 05:18:38 pm
yes, but you have to hit compile and not upload
/tmp/build{numbers}

You could find exactly the directory by pressing ctrl-comma and makeing compiling verbose; when you compile it'll have that directory everywhere.
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)

Code:
// 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.
787  Using Arduino / Installation & Troubleshooting / Re: Error on compile -stdlib.h not found on: January 14, 2012, 12:40:36 am
Are you having the problems with windows or linux? What distro? Do I see that you have arduino installed in the root directory? That sounds like a bad idea.
788  Using Arduino / Installation & Troubleshooting / Re: Arduino 1.0 compile issues on: January 14, 2012, 12:37:34 am
I'm running archlinux and it doesn't highlight the line numbers for me, either. It's especially annoying since the line numbers correspond to the IDE-processed sketch rather than the one I can actually see. :/
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"
791  Using Arduino / Programming Questions / Re: library definition on: January 12, 2012, 09:47:59 pm
What about looking into const global variables? They'll get optimized away no problem, and you'll be able to see them from every file in your project.
792  Using Arduino / Installation & Troubleshooting / Re: Arduino on Puppy Linux on: January 12, 2012, 01:19:07 am
http://arduino.cc/playground/Linux/All
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:
Code:
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.
794  Using Arduino / Programming Questions / Re: Strange behavior in char based switch/case on: January 10, 2012, 12:10:32 am
For a second character, you could nest the switch statements:
Code:
byte val1 = Serial.read();
switch(val1) {
case s:
  byte val2 = Serial.read();
  switch(val2) {
    case r:
    break;
  }
  break;
}
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:

Code:
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();
}
 
Pages: 1 ... 51 52 [53] 54 55 ... 68