Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 53
61  Community / Bar Sport / Re: Interstellar Travel on: September 14, 2012, 07:37:55 am
Their reality check needs a reality check of it's own.

The trip to the moon was about 240k miles one way.  That's about 10 times the circumference of our planet.  Fairly comprehensible numbers.

The trip to our nearest star (Proxima Centauri) is about 4.3 light years, or 252,700,000,000,00 miles.  That's a bit over 100 million times the distance to our moon.  To put it another way, the logistics of making a trip to Proxima Centauri are about 100 million times more challenging than making a trip to our moon.

We need some incredible, ie revolutionary, breakthroughs in Research and Development.  I can understand the desire to reach for the stars, but we haven't even put a man on another planet in our own Solar system yet.  I think a good analogy would be something like Columbus talking to the queen about planning a trip to the moon before he even made it across the ocean to the new world.

Personally, I'm of the opinion that we should be focusing more on just returning to the moon and establishing a completely self-sufficient base of operations there before even setting our sights on a target like Mars.  The only trouble with that is it just doesn't capture the interest of the general public, so it becomes difficult to drum up support and funding for such an endeavor.
62  General Category / General Discussion / Re: Best coding practice. on: September 12, 2012, 03:12:28 pm
In C++, int values will be automatically cast to bool values in the following manner:
0 is false.
All other values (whether positive or negative) are true.

Not necessarily the most intuitive conversion of values, so it's often more clear to use a specific comparison operation when using ints in an expression.
63  General Category / General Discussion / Re: C++ in embedded on: September 12, 2012, 03:06:34 pm

I did not asked you what to do ..


Perhaps not, but when entire books are written primarily to answer the questions you ask here, then the answer to your questions are, go read the books.
64  Using Arduino / Motors, Mechanics, and Power / Re: Short power with more than 2 servos on: September 12, 2012, 01:51:50 pm
Can you provide a simple schematic, or at least specifics on exactly what pins are connected to what?
65  Using Arduino / Motors, Mechanics, and Power / Re: Stepper motor used as a servo on: September 12, 2012, 01:47:13 pm
It doesn't appear that you're using any sort of positional feedback on that stepper motor, which doesn't really make it a servo.  Still a nice demo, and a good use of salvaged printer hardware (I have two old printers in storage just waiting for me to get around to tearing the goodies out of their guts).
66  Using Arduino / Programming Questions / Re: One request from beginner - Motor Shield + Arduino UNO. on: September 12, 2012, 10:24:23 am
Or, alternatively, you could do the legwork yourself.
67  Using Arduino / Programming Questions / Re: One request from beginner - Motor Shield + Arduino UNO. on: September 12, 2012, 09:56:38 am
Google is an excellent resource for finding 'stuff' in general.  This  includes tutorials of all sorts, which includes Arduino tutorials, which even includes tutorials on driving motors with an Arduino and H-bridge/motor driver/motor shield.
68  Using Arduino / Programming Questions / Re: How accurate are delays within loops on: September 12, 2012, 09:54:15 am
delay() is pretty accurate, but fairly useless for a variety of other reasons.  One of them of course being the problem you are running into.  It's rather useless when used in conjunction with the rest of the program to perform overall timing.

Take a look at the Blink without Delay sample.  That provides a good method for overall timing.
69  Using Arduino / Programming Questions / Re: How to save a constant updating value on: September 12, 2012, 09:51:58 am
To everyone who assumes my code will not compile, you look really ignorant and rude right now as my code def compiles and will fully upload and run on my build.

No assumptions have been made.  The code you provided in your initial post does not compile, period.
I highly recommend reading the sticky in this forum.  The one titled 'Read this before posting a programming question'.  Perhaps you already think you know what that post contains.  I can assure you though, based on the above comment you've made, you have no idea what that post contains.
70  Using Arduino / Programming Questions / Re: Is there an easier way to do all of this? on: September 10, 2012, 07:38:26 pm
You are creating a whole bunch of consecutive pointers into your array inParse, when you can just pass that array into your sort methods.
And since your chan array lines up with your parsed array, you can also loop through the assignments instead of individual separate assignments.  Here's an example (separate from your own sources):


char buffer[] = "12,345,55,178,9,77,900,122";
//inParse only needs to be as large as the number of individual int strings strtok will find in buffer
//It does not need to be as large as buffer
char *inParse[8];
int values[8];

void setup()
  char *s;
  int count = 0;
  s = strtok(buffer, ",");
  inParse[count++] = s;
  while(NULL != s)
    s = strtok(NULL, ",");
    if(count < 8) inParse[count++] = s;
  //We only need to pass in a single value, a pointer to our array of pointers
  //ie, a pointer to a pointer (char**)
  for(int x = 0; x < 8; x++) Serial.println(values[x]);

void loop(){}

//An array of pointers is basically just a pointer to a pointer
void Convert(char** arr)
  for(int x = 0; x < 8; x++)
    //Here's where the magic happens.
    //We dereference our array pointer, to pass our char * to atoi()
    //And also increment the array pointer to the next element in our array
    values[x] = atoi(*arr++);
    //Or, if you're having trouble wrapping your mind around that, try this:
    //values[x] = atoi(arr[x]);

No, I'm so used to HTML that this is the structure I am used to seeing, and makes it easier for me to read my own code... Even my java looks like that...
When asking strangers for help, it's probably best to try to accomodate them as best as possible.  Help them help you, and you'll get better help.  Hint:  The Arduino IDE has an Auto Format capability in the Tools menu.

I don't have to take serial data as String?
No.  You can, and should, stick to char arrays.

From here on out, it is obvious to me that you are a much more advanced C++ programmer than myself. I have no idea what a bounds check is...
Bounds checking isn't all that advanced stuff.  You should spend some time brushing up on your C++ skills.  In summary, C++ does very little for you.  if you create an array of 5 elements, you can try to access the 10th element, and C++ won't stop you.  You'll just access memory beyond the array, and who knows what value that memory is going to contain.  Worse still would be changing that memory.  It's up to you to make sure you're index values are within the bounds of your array.
71  Community / Bar Sport / Re: What is the most expensive board you ever smoked? on: September 07, 2012, 08:57:05 am
This isn't an instance of me frying some hardware, but an amusing instance still.

Back about 12-14 years ago we were working on a new product that supported two new cameras from Dalsa, one a high speed 2k linescan camera, and the other a high speed 2kx2k areascan camera.  Both cameras were in identical packaging with identical connectors.  However, the linescan camera operated on 24v and the areascan camera only operated on 12v.  Needless to say, it was entirely possible to connect the 24v power supply to the 12v camera.  Our lead engineer was constantly lecturing everyone about the risk, and to always be sure what camera and power supply they were using (the power supplies were identical in appearance as well).  About a month into the project, the lead engineer was the one to plug the 24v power supply into the 12v camera.  And of course, the areascan camera was the more expensive of the two as well, $20k at the time vs I think $7k for the linescan.
72  Using Arduino / Programming Questions / Re: Passing char arrays to a function then using strcat() on: September 07, 2012, 07:35:58 am
If I pass a character array to a function, then add to it by using strcat() will my program adjust the memory allocated for this char array, or am I going to run into a memory problem.  For example

strlcat() can be used to prevent writing outside the bounds of the destination buffer.  It will just truncate the second string if necessary.  Here is the reference for all the C string library functions:
73  Topics / Robotics / Re: Servo (PAN) and Parallax Ping))) on: September 06, 2012, 10:17:43 am
Code re-use is a wonderful thing:,106043.0.html
74  Topics / Robotics / Re: Robot From An Existing Toy on: September 06, 2012, 10:15:14 am
There are plenty of rover kits that are designed to be custom modified as well as integrated with an Arduino.  These kits will almost universally be a better option than buying a new toy and hacking it apart.

Now, buying an old RC toy car from a yard sale for a few bucks, that may be worth the effort, since there's little financial investment involved, and a similarly sized robotic rover will be substantially more money (think of the Dagu Wild Thumper 4wd/6wd rovers).
75  Topics / Robotics / Re: And another self balancing robot on: September 06, 2012, 07:04:21 am
His code is published for all to see.  Go read it.  There are no physical computations.  There are no torque calculations. I'll sum it up as thus:
He reads an IMU and computes an angle based on those readings.
He feeds that angle into a PID controller that, with three tweakable parameters (Kp, Ki, Kd) outputs a raw value.
He clamps this raw value to the range his motor controller wants to use.
He feeds this value into the motor controller, that simply linearly converts it to some PWM output to drive the motors.

With the exception of some remote control code, that is ALL his code does.  Again, the code is available.  You are arguing that he is doing things that simply aren't in his code.  That's the beauty of PID controllers.  You can spend days, weeks, even months, developing an accurate physical representation in code that MAY be able to properly balance your robot, or you can spend hours writing a simple PID controller, and maybe another couple of hours tweaking the PID to balance your robot.  This is a method that has been used thousands of times by a variety of people, myself included.
Pages: 1 ... 3 4 [5] 6 7 ... 53