1 Programming Platforms

While this book will concentrate on elements that extend across multiple languages and platforms, we will focus on a few to provide practical examples and opportunities to put ideas into action. We concentrate on open source options for programming so that you will always have them available, no matter what environment you are working in.

It’s usually easier to work in an integrated development environment (IDE) rather than at a command line prompt, and there are sections in the back of the book to help you install and get several environments up and running. They are each labelled as “Getting Started with …”

C

ANSI C is the standard and the second edition of Kernighan and Ritchie is a great reference to have on the shelf. Just about everything is written in C once you get to the bottom of it. The most widespread open source compiler option is gcc and the absolutely simplest way to use it is with a text editor and a terminal command line. (video 3:02) You will probably want an integrated development environment if you will be doing more with C programming on a computer screen.

Another option for a little practice in C is https://www.onlinegdb.com/ where you can cut and paste some code and see what results, complete with debugging output.

Arduino IDE

The Arduino Integrated Development Environment (IDE) and Framework uses C for writing user code to achieve practical microcontroller applications. Libraries are written in C++, extending the basic capabilities. Most C examples in this book will be realized on Arduino, with explanatory materials to link them to ANSI C if needed. Download and install a copy for your operating system from arduino.cc. We will only be specific about Arduino versus ANSI C when there are differences.

Python

Python 3 is widely used for general purpose computing, and especially for science, engineering and analysis through the SciPy library systems. Ignore Python 2 unless you need to support legacy code. Take advantage of Anaconda to download and install a complete environment, including Jupyter Notebooks for an easy to use platform to explore Python. Most Python examples in this book will be provided as Jupyter Notebook files.

CircuitPython

CircuitPython is an Adafruit version of the MicroPython implementation for microcontrollers. It doesn’t support 8 bit microcontrollers like the UNO, however it is an interesting option for rapid prototyping of microcontroller applications with the power of Python. This book will provide some examples to compare with programming in C. What you lose in speed and direct control over the hardware may be offset by the programming simplicity.

MATLAB

MATLAB(R) is a proprietary product from MathWorks that is widely used in academic settings. Much of what can be achieved in MATLAB can also be done in Python with NumPy to provide the matrix support. The primary disadvantage of MATLAB is its proprietary nature, resulting in many engineering workplaces where MATLAB is not available as a problem solving tool. Limited examples will be provided to help students compare and contrast with other approaches and translate their MATLAB code to Python.

License

Icon for the Creative Commons Attribution-ShareAlike 4.0 International License

Rick's Measurement for Mechatronics Notes Copyright © 2019 by Rick Sellens is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, except where otherwise noted.

Share This Book