Show Posts
Pages: 1 ... 11 12 [13]
181  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Lightshow on: September 19, 2008, 03:12:59 am
Well, I would recommend understanding the two examples above, and then adapting their code to your needs. That way you get a sketch that works and you will have learned a technique you can reuse later.

Since both use the button to turn a LED on or off, it should be relatively easy to adapt them to turn your light show on or off.

In general, it is recommended to do the tutorials and examples that have something to do with your project, since this can answer many basic questions you might have.
182  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Lightshow on: September 19, 2008, 02:25:41 am
Have you tried the tutorials? There is one called button. The code should be in the examples included with the software you use to send a sketch to the board.

Once you understand that one, you can move on to debounce, which shows a better way to interact with a button, but is more complicated.
183  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Serial protocol how-to on: September 13, 2008, 02:32:22 pm
Hey, thanks for sharing those, I didn't know them! :-)
184  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Serial protocol how-to on: September 13, 2008, 02:23:32 am
Depending on how much overhead you have left in your bandwidth, you might want to NOT send your data as bytes but as chars (Three bytes per byte, so not super efficient) or to reserve certain values for control characters (might be difficult for you since you have exactly 8 bits of data per line) or to preface each pair of value bytes with, say, a byte set to zero and interpret each triplet as a three-byte number and anything over 65,535 is garbled data.

You lose bandwidth but you gain legibility both for a human peeking at the exchange and for the arduino.
185  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Serial protocol how-to on: September 12, 2008, 04:04:56 pm
This may be a stupid suggestion, but I've had good results taking a leaf from GPS NMEA strings. I've just never tried it quite that fast (more like 9 bytes 5 times a second).

I start a sentence with a special character, say '$', then two-three characters describing the sentence structure if there are several possibilities, then a series of values separated by commas, and stop a sentence with a carriage return. My values uses three bytes and only one sentence structure, but in your case a comma every two or four bytes makes more sense, with perhaps a different sentence header for each line of the matrix?

You can then use the GPS NMEA string reading code from the examples with some modifications. You get the occasional garble, but it resets at every sentence. Your code could stick incoming serial data into an array until it gets a carriage return, recognize the header to ID the line, then split it at the commas, and finally decode the values between the commas. Update matrix, start over with contents of serial buffer.

I dunno if this would work fast enough for you, tho.
186  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How accurate can I be with Servos? on: September 13, 2008, 02:34:11 pm
I like the idea of decoupling the encoders to measure the distance from the motors driving the wheels, with different gearing and perhaps on different wheels?
187  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How accurate can I be with Servos? on: September 12, 2008, 01:58:09 pm
I was assuming the distance changes from iteration to iteration, but if it is always the same, then yes, both solutions would be a lot simpler!  :smiley
188  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How accurate can I be with Servos? on: September 12, 2008, 04:56:43 am
I'd print and paste, or buy from someplace like this. Alternatively, you could make your own rubber wheel-stamp with some creative carving, rolling on the ground and against another roller to ink it. Can I leave it as an exercise for the class? ;-)

For ease of deployment, I'd much rather dead reckon between markings each X centimeters, of course, as suggested at the end of my post.

Depends on the requirements for accuracy and the capabilities of the dead reckoning.
189  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How accurate can I be with Servos? on: September 12, 2008, 03:40:45 am
Perhaps if the surface can be marked, reasonable accuracy can be achieved by using it as part of a giant encoder. A light sensor running over a series of bar-code-like markings would detect pulses you should be able to read.

Three decimal places on meter-range distances is millimeter resolution, which should be fairly easy to mark accurately over a 50 meter distance. The design of the 'bar-code' would be the smart bit, but if your dead-reckoning is good over, say, ten centimeters (definitely feasible with good steppers), you could encode an absolute distance every ten centimeters over one centimeter (50 meters every ten centimeters would need 500 absolute references so 10 bits would be plenty, meaning at one millimeter per bit your reference would span ten millimeter or one centimeter) and then just have millimeter tick-marks in between.

Not for the faint of heart, but I think it might be implementable reasonably cheaply and easily.

A simpler version, if you're happy with the accuracy of your dead reckoning over fairly long distances (e.g. ten centimeters), would be to only mark the surface every interval to reset the dead reckoning. No need to have millimeter tick-marks, just an accurately positioned band every ten centimeters. You might even be able to hide such a design as part of some graphics on the surface.
190  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: PWM (delay) problems on: September 03, 2008, 03:02:59 am
Oh, and I understand it is not recommended to use delayMicroseconds() for more than a millisecond. For one thing, system timer does not update during that delay, and other things are suspended (i think). To delay for 6.7ms, for example, you'd want to chain a delay() and a delayMicroseconds(), would be my understanding.
191  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: PWM (delay) problems on: September 03, 2008, 03:00:33 am
I'm not sure about the delay issues (I would have said to int() the value just to be safe, and if is delayMicroseconds, be aware that delayMicroseconds(0) causes unexpectedly long delay, so that I always make the delay be at least 2 or 3 uS long no matter what), but as for the legibility of the code, have you tried using switch case instead of those else-if statements?

http://www.arduino.cc/en/Reference/SwitchCase

I'm a bit confused about the syntax at the end of several of your functions where you do this



void blabla
{
  read pin value

  else-if-else-if

  functioncall //this functioncall is formatted like it's in the else-if, but if I read the {} right, it isn't

  {
     functioncall //this second functionall is the same as the first, why the different syntax?
  }
}



Am I missing something, or are you invoking the same function twice in a row, but with slightly different formatting? It almost looks like the first call is meant to be in the else-if statements, but isn't? Is there a trick I'm not aware of which requires invoking a function inside curly braces like you do the second time? The arduino reference for curly braces makes no mention of it...
192  Forum 2005-2010 (read only) / Bar Sport / Re: TEST Please ignore. on: September 25, 2008, 04:49:30 am
Quote
testing

... Phil's sanity  smiley-grin
193  Forum 2005-2010 (read only) / Bar Sport / Re: Cheap Oscilloscope on: August 31, 2008, 04:15:04 pm
The other downside to sound card oscilloscopes is that most cards are mono on mic input... so you only have channel on the scope.

I'd gladly pay $60 for a second channel when I'm working on stereo sound generation!
Pages: 1 ... 11 12 [13]