Track My Order
Frequently Asked Questions
International Shipping Info
Mon-Fri, 9am to 12pm and
1pm to 5pm U.S. Mountain Time:
Chat With Us
December 31, 2012
News - IoTuesday: Maximize Your …
You don’t need another servo to handle polarization, you need a circularly polarized antenna. Those can handle either vertical or horizontal linear polarization. They only have a problem when used with another circularly polarized antenna that has the opposite polarization, i.e., left hand vs. right hand polarization. In that case you could make an array of 2 circularly polarized antennas with opposite polarizations and have a switching element (diode, relay, etc.) that is driven by a single GPIO output. You may want to consider antennas used for amateur satellite stations. They have to handle random polarization changes caused by Faraday rotation, as well as low signal levels.
I would never use anything but DIY antennas for this. They are so easy to build and use so little material that it’s not worth it buying a commercial model. I was once able to extend the range of a key fob transmitter from 5 to 125 feet with a homemade replacement antenna. In this case, though, I put the new antenna on the base station, not the fob. Instead of a single wire, I had a vertical groundplane antenna with the impedance matched to the transmitter (hint - in commercial gear it’s always 50 or 75 ohms) simply by bending the groundplane wires. So keep in mind that the base station antenna might be a more fruitful target for replacement.
Finally, the ARRL has lots of books with data for easy to make DIY antennas from shortwave to microwave.
News - Adventures in Science: Ar…
about a month ago
Microsoft used to be notorious for dropping into assembly language in Windows back in the 90’s. Anytime they wanted exclusive access to a shared resource they’d throw in an asm cli to disable all interrupts (including, thanks to some rotten hardware design the non-maskable interrupt). Then, when they were done, they’d throw in an asm sti to re-enable them - usually. There were many non-deterministic paths to bypass the re-enable, so there were a lot of times when the computer would just hang after a particular set of operations.
They were violently weaned of this dubious habit by Dave Cutler when he jumped ship from DEC to come to MS to lead the effort of developing Windows NT, which had to run on both Intel and DEC hardware. He had the crew do the DEC Alpha build every morning before the Intel build and if it failed to build because of embedded Intel assembly language, he would hold a shouting session that involved throwing chairs and kicking trash cans. Raw terror eventually overcame ignorance and the MS crew used the semaphores (which they called spinlocks) that real OS developers had been using since 1962 and asm cli faded away.
You missed ++a and –a; They’re the same as a++ and a– except for when the operation occurs. The prefix operators happen before the variable is accessed, the postfix after.
a = 5;
b = a++;
leaves a equal to 6 and b equal to 5.
a = 5;
b = ++a;
leaves a and b both equal to 6.
This lets you do some really slick stuff with loops and such.
Edit - oops, sgrace beat me to it
One slick trick is to replace multiply and divide operators with the shift operators when the multiplicand and dividend are integers and the multiplier and divisor are powers of 2. In the good old days this would radically speed up the operation.
These days, between crazy fast hardware and super-optimizing compilers, it’s just a stunt to amaze and amuse (and sometimes confuse) your friends with. In fact. all good compilers now make the substitution for you, and in many cases, the hardware will do it if the compiler didn’t.
Tutorial - Getting Started With the micro:bit
about a month ago
If it had a real compiled, strongly typed programming language instead of the toy or interpreted ones I’d order several right now.
char is implementation defined. It can be signed or unsigned by default based on the compiler writers' whims. That’s why it’s always safest to specify the option you want.
We’ll have to agree to disagree on this.
The examples you’re citing are fine for C. In fact, they’re absolutely necessary for C since C has one global namespace. For C++ (as on the Arduino) they are crutches used by old C programmers who never made the conversion to thinking in the new language. It’s the same as all those folks who persist in using char arrays instead of templated container classes, void pointers instead of templates, printf instead of stream I/O, C-style casts instead of C++ casts, etc. It’s like a person wandering through 21st century Rome trying to get by speaking Latin instead of Italian. They probably won’t starve and they may even have a good time (the program works) but it’ll be inefficient and annoying.
The pre-processor is the ultimate untyped language - you can define anything to be anything else. It’s a true programming language with a lot of power. I’ve written macros that solve the Towers of Hanoi problem when evaluated in the pre-processor, without ever invoking the compiler. And that’s the key - without ever invoking the compiler. It works completely outside the type-checking and error detection protections offered by the C++ compiler. It follows none of the language rules.
If you have a strongly-typed, object-oriented language why would you ever want to overlay that with a disorganized rogue layer that can hide errors under many layers of definitions and includes? That’s why the pre-processor is evil.
To be fair, there is one legitimate use for the pre-processor - including files. But #include doesn’t override any of the compiler and language features. It’s just a patch on the build system (which actually is no longer necessary with modern IDEs).
Finally, I too have written hundreds of thousands of lines of code in C/C++ and other languages. That’s not evidence one way or the other about the proper use of the pre-processor, but you seem to care so there it is :-)
The pre-processor in general, and the #define of a constant value, is evil!
pollutes the namespace. Once you #define a value, you can never use a different definition without #undefining it first. Keeping track of that kind of monkeyshines is invitation to catastrophe.
If this is not clear, consider the actual problem I ran into 3 hours ago. I had a class which contained a constant like this:
static const int FLOAT = 1;
Then when I tried to use it:
int dataType = foo::FLOAT;
It gave me an error saying that “float” was an illegal token, even though I had named my constant “FLOAT”, not “float”
After some searching, I found that a vendor-provided header file contained:
#define FLOAT float
Since they used a pre-processor definition instead of a namespaced declaration, that meant that I could never use the constant “FLOAT” anywhere in my program except as an alias for “float”, even if I fully-qualified the name with a namespace. My namespace is polluted with an alias I don’t need or want. I had to change my constant to “FLOATING”.
Not only does this kind of thing happen all the time, but they tend to grab all the good constant names. WindRiver stole “DEBUG” in a VxWorks header file this way. There are too many examples to list, just keep in mind that the preprocessor is evil and use namespaced constants instead.
And to answer Shawn’s question, strongly-typed languages rule. Bugs generally get 10x more expensive to find and fix every stage they pass through. The earlier you can find one, the cheaper the process (or faster if you’re a hobbyist who does this for free).
News - According to Pete: Point-…
about 2 months ago
…can’t figure out why people still do it
First, some of us actually enjoy wire wrapping, as well as soldering. When done with manual tools (stripper, wrapper, etc.) it’s got a satisfying mechanical zen that soldering irons can’t match, much like caulking the planks of a clinker-built boat.
Next, there’s no danger of setting the house on fire or burning a hand or a favorite pet’s nose. There’s no toxic chemicals (lead, rosin, etc.) It’s much easier to undo than a solder joint and it’s easy to inspect for quality. The only consumable is 30-guage wire. There’s no wet sponge. There’s a basic simplicity about just wrapping a wire around something, as well as the magic of it being a gas-tight mechanically sound connection in spite of the simplicity.
Mind you, I still solder a lot, but there are times when wire wrap is more soul-satisfying. Hope this helps.
Here’s my version of a 1-tube regenerative receiver from Practical Electronics. The original design by Dave Green, W6FFK, was pure 1967 amateur tech with an aluminum Minibox chassis. I substituted the parts I had in my junkbox where necessary and built it on a chassis made from double-sided coppper-clad board (so even the chassis is point-to-point soldering). Anytime I needed to solder to ground it was a simple step to just solder to the chassis.
As you can see, the parts go point-to-point from the tube socket to ground, from the terminal strip to ground and from the tube socket to the terminal strip. The red wire from the power supply is +125VDC, so definitely don’t touch the terminal strip until the power supply filter caps are discharged.
My only issue with some of the ptp creations I’ve seen is the shock/vibe sensitivity. Many of them are way too fragile.
No public wish lists :(
Forgot your password?
No account? Register one!