Unionize Your Variables – An Introduction To Advanced Data Types In C

Programming C without variables is like, well, programming C without variables. They are so essential to the language that it doesn’t even require an analogy here. We can declare and use them as wildly as we please, but it often makes sense to have a little bit more structure, and combine data that belongs together in a common collection. Arrays are a good start to bundle data of the same type, especially when there is no specific meaning of the array’s index other than the value’s position, but as soon as you want a more meaningful association of each value, arrays will become limiting. And they’re useless if you want to combine different data types together. Luckily, C provides us with proper alternatives out of the box.

This write-up will introduce structures and unions in C, how to declare and use them, and how unions can be (ab)used as an alternative approach for pointer and bitwise operations.

Continue reading “Unionize Your Variables – An Introduction To Advanced Data Types In C”

Mechanisms: The Reed Switch

Just about everywhere you go, there’s a reed switch nearby that’s quietly going about its work. Reed switches are so ubiquitous that you’re probably never more than a few feet away from one at any given time, especially at home or in the car. You might have them on your doors and windows as part of a burglar alarm system. They keep your washing machine from running when the lid is open, and they put your laptop to sleep when you close the lid. They know if the car has enough brake fluid and whether or not your seat belt is fastened.

Reed switches are interesting devices with a ton of domestic and industrial applications. We call them switches, but they’re also sensors. In fact, they only do the work of a switch while they can sense a magnetic field. They are capable of switching AC or DC at low and high voltages, but they don’t need electricity to work. Since they’re sealed in glass, they are impervious to dirt, dust, corrosion, temperature swings, and explosive environments. They’re cheap, they’re durable, and in low-current applications they can last for about a billion actuations.

Continue reading “Mechanisms: The Reed Switch”

Images As Excel FIles Are Gloriously Nasty

Almost every person of a technical persuasion who has worked in an office will have some tale of wildly inappropriate use of office technology for a task that could have been accomplished far more simply with an appropriate tool. There are jokes about people photocopying a blank sheet of paper when they need a few sheets themselves, but some of the real stories are very bit as surreal.

[Bjonnh]’s patience for such things was exceeded when he received a screenshot embedded in a Microsoft Word file. His response is both pointless and elegant, a Python script that takes a JPEG image and encodes it into an Excel file. It’s simply an array of cells whose background colours represent the pixels, and he warns us that the output files may take a while to load. We just had to subject it to a test, but are sorry to report that LibreOffice doesn’t seem to want to play ball.

So yes, this is a small departure from our usual fare of hardware, and it serves no use other than to be a fantastically awful misuse of office technology. If you’ve ever been emailed a PowerPoint invitation to the office party though, then maybe you’ll have cracked a smile.

If pushing your corporate spreadsheet to the limit is your thing, perhaps you’d also like to see it running a 3D engine.

Repairs You Can Print Contest: Meet The Winners

Six weeks ago, we asked you to show us your best 3D printed repairs for a chance to win $100 in Tindie credit and other prizes. You answered the call with fixes for everything from the stuff everyone has, like zippers and remotes, to the more obscure stuff, like amazing microscopes scavenged from dumpsters.

It was hard to whittle down the entries we received into the top 20 because you came up with so many awesome fixes. A few of them had us thinking hard about the definition of repair, but are brilliant in their own way.

So without further ado, we are pleased to announce the winners of our Repairs You Can Print contest. We also want to give honorable mention to those projects that wowed us with ingenuity.

Continue reading “Repairs You Can Print Contest: Meet The Winners”

Katherine Johnson: Computer To The Stars

In 1962, John Glenn sat in his capsule waiting for his rocket engines to light-up and lift him to space. But first, he insisted that Katherine Johnson double-check the electronic computer’s trajectory calculations. While that’s the dramatic version of events given in the recent movie, Hidden Figures, the reality isn’t very far off. Glenn wasn’t sitting on the launchpad at the time, but during the weeks prior to launch, he did insist that Johnson double-check the computer’s calculations.

So who is this woman who played an important but largely unknown part of such a well-known historical event? During her long life, she was a wife, a mother, an African-American, a teacher, and a human computer, a term rarely used these days. Her calculations played a part in much of early spaceflight and in 2015, she was awarded the Presidential Medal of Freedom by President Obama. She also has a building named after her at the Langley Research Center in Hampton, Virginia.

Continue reading “Katherine Johnson: Computer To The Stars”

World Create Day Is The Hackaday Event In Your Neighborhood

Hackaday World Create Day is on March 17th and it’s happening near you. Get together with hackers in your area and create something. Sign up now to host a World Create Day gathering! These are really easy to organize, but we can only do it with your help.

The Hackaday community from around the world will meetup and spend time building together on Saturday, March 17th. Pick one of those projects you’ve been meaning to dive into and get together with some old and new friends to hack on your projects together.

You should make this day your own. As with any hands-on hacking events it’s a good idea to block out a bit of time at the end for lightning talks to show off the builds everyone has been working on. Make the memories live on past a single day by taking pictures and posting the story of your World Create Day meetup. We enjoyed getting a great look at many of last year’s meetups this way and want to expand the builds we feature on the front page this year.

Meetup Organizers Wanted

Fill out this form to let us know you want to host a meetup.

Every year we have World Create Day meetups all over the world which are set up by local organizers. Many of those will happen again this year, but we also need you to organize an event in your area. We’ll help you get things set up and put your event up on the big map so others in your area will plan to join in. Do it now, if we get your shipping info early we’ll send you stickers and other swag to hand out at your gathering.

Build Something that Matters

The core of World Create Day is to stop making excuses and just build something. Great builds start with a plan. The Hackaday Prize will begin soon, and since you’re already getting together with other people, form a team and dream up your entry.

This is your take on building something that matters to the world. Come up with a plan that solves a problem facing humanity and publish your work on Hackaday.io. You may be surprised by the support you get for your idea, but you’ll never know until you put an idea out there. Join in Hackaday’s World Create Day on March 17th and let’s show the world the kind of hope that blossoms when we decide to build something that matters.

SpaceX Joins In The Long History Of Catching Stuff From Space

On February 22nd, a Falcon 9 rocket lifted off from Vandenberg Air Force Base in California and successfully delivered into orbit an Earth-observation satellite operated by the Spanish company Hisdesat. Compared to the media coverage received by the launch of the Tesla-laden Falcon Heavy earlier in the month, this mission got very little attention. But that’s hardly surprising. With respect to Hisdesat, the payload this time around was not terribly exciting, and even the normally dramatic landing of the Falcon 9’s first stage was skipped in favor of simply allowing the booster to crash into the ocean.

As far as SpaceX launches go, this one was about as low-key as they come. It wouldn’t be a surprise if this is the first time some readers are even hearing about it. But while it didn’t invoke the same media circus as the images of a spacesuit-wearing mannequin traveling into deep space, there was still a historic “first” performed during this mission.

In an effort to increase the re-usability of the Falcon 9 booster, SpaceX attempted to catch the payload fairing (essentially a large protective nose cone) with a huge net as it fell from space. The most interesting thing about this new chapter in the quest for a fully reusable rocket system is that while SpaceX is generally considered to be pioneers in the world of bringing hardware back from space, this particular trick dates all the way back to the 1960’s.

Continue reading “SpaceX Joins In The Long History Of Catching Stuff From Space”