KC7MM Wiki

Amateur Radio with KC7MM

User Tools

Site Tools


Learn to Program

(Linux User net, March 4, 2019. KC7MM, NCS)

Programing computers is both a skill and an art. But mostly it's a means of getting useful things done.

Why would I want to write a program?

Computers are assuming an ever-increasing role in Amateur Radio, and everything they do is driven by software. Homebrewing is a long-standing ham practice, and writing programs carries it over into the digital realm. Here are some things that might persuade you to give coding a try.

  • You can make a program that does exactly what you need done – and nothing more. It satisfies your specific needs.
  • Your program can be made to work the way you do. You don't have to adapt to someone else's idea of how it should function.
  • Automate repetitive tasks. How many times have you found yourself repeatedly running through the same series of steps on your computer? That's a good candidate for a software script that will relieve you of that tedium by doing it all with one commend.
  • Join in the SDR revolution. Software defined radio is rapidly transforming our hobby. That opens to us an array of interesting possibilities, such as developing our own custom rigs and operating them by remote control. Use your programming knowledge to assemble your shack from hardware components (HackRF One) and SDR code libraries ( GNU Rado).
  • Utilize single-board computers and microcontrollers such as Raspberry Pi and Arduino for your DIY projects. Roll your own, or adapt one of a vast number of projects available online to suit your particular needs.
  • It's Free. Your own software is free as in “freedon” – you can do anything you want to do with it, and no one can dictate otherwise. And it's free of cost, other than for the time you spend writing it. The compilers and development environments you need to run and write it are freely availble for most languages.
  • Share it. Build an electronic circuit, and it's yours alone. Build software, and you can easily share it with as many others as you like.

What language should I learn?

There are a bewildering number of computer languages from which to choose. How can you possibly decide which one to learn? Well, let me recommend one: Python. Python (named after Monty Python) is widely used as a first language in computer science programs, is one of the most popular of general-purpose langages. Following are some reasons why this is so.

  • Versatile. Python is well suited to a huge range of uses. For example, it has become the language of choice in the scientific, statistical, artificial intelligence, and bigg data fields. It is installed by default by most Linux disttibutions and on OSX, and often is employed for their system administration utilities.
  • Good teaching language. Python is relatively easy for a programming novice to learn. Its syntax is clean and straightforward, and a beginner can start doing useful things with it at an early stage. It also embodies in some form most concepts behind modern programming languages. So, you can learn them in Python, and be able to use them when encountered in any other language that you might try.
  • Expressive power. Python originated as a scripting language, so it is designed to do a lot of work with minimal code. For example, I have done things with a few lines in Python that would have required many dozens of lines to do in C.
  • Libraries, libraries, libraries. Modern computer languages use code libraries to encapsulate specialized bits of pre-compiled software, which can be pulled into other programs as needed. For example, python comes with a math library that contains math and trig functions that can be used in programs. Developers can build their own libraries, and thousands of those custom libraries are available for Python, for nearly every imaginable purpose. In the Amateur Radio world, the Hamlib ham radio control libraries are used by virtually all PC programs that offer rig control.
  • Cross-platform. Python now runs under Linux (and any other Unix-based system), Windows, OSX, Android, iOS, and some microcontrollers. A simple console program likely will run on all of them. GUI applications are trickier, but can work with the proper tookit.
  • Someone has already done it. Whatever it is you want to do, there's a strong chance that someone has already done it – or has tried to do it – and has code online that you can use or learn from for your own project. Run a search for Python plus your topic to find it.

How can I get started?

Owing to Python's popularity, there are many resources available online for learning it.

What else?

Other languages

Of course, Python is not the only game in town. Linux users can learn some shell scripting, either for bash or chs (a C shell). It's possible to build extremely powerful programs that way. For instance. the git software repository system was originally written by Linus Torvalds as a collection of shell scripts.

For Arduino programming, C++ is the language used, though plain C will work for most purposes.

Satisfaction guaranteed

Finally, consider the satisfaction that comes from building one's own stuff. Anyone who has built things from scratch – or even from a kit – knows the pleasure of owning and using something that wasn't “just bought”.

sw/programming/why_program.txt · Last modified: 2019/03/04 21:16 by KC7MM