Difference between revisions of "Programming"

From biophysics
Jump to navigation Jump to search
Line 61: Line 61:
 
* Sock vibrator
 
* Sock vibrator
 
====Arduino====
 
====Arduino====
<todo>
+
Arduino devices or compatible embedded CPU's are programmed with the Arduino IDE. The programming language is C++.
  
 
====Raspberry Pi====
 
====Raspberry Pi====
 
<todo>
 
<todo>

Revision as of 12:02, 24 October 2023

Introduction

Most work in the Biophysics group is done with help of Matlab (Experiments, data manipulation, graphics). Embedded systems are mostly written in C++. Tucker Davis equipment have their own graphical programming system.

Best practices

When programming one of the first things you have to consider is how your program will be used.

  • Will other people use the program?
  • Will it be used for a long time?
  • Will it be used for science?
  • Do other people need to understand or be able to edit your code?
  • Do you anticipate changes in the future?

If you can answer one of these questions with yes you should use best programming practices

  • Use proper code indentation
  • Use meaningful names
  • Use comments that add context
  • Don’t use the same lines of code more than once
  • Be sparse with nesting
  • Use refactoring of larger pieces of code
  • Make room for ample testing

Your code is worthless if you are the only one who can understand it.

Good coding needs effort, patience, discipline and courage to rethink.

Matlab

The Matlab IDE gets updated almost every year. Different experimental computers and your own computer will probably run different version of Matlab. Most of the programs will be compatible, but user interfaces often not. On Gitlab we have several libraries for experiments and data manipulation.

<todo>

Installation

<todo>

License

<todo>

Systems

<todo>

Experiment computers

The experiment computers in the labs are all windows computers. Most of the experimental programs running on these computers are written in Matlab.

<todo>

Digital sound processor (DSP)

The most used DSP is the RZ6 of Tucker Davis. Also the older RP2.1 and the Medusa RA16 base station are still in use. These are programmed in the RPvdsEx IDE. For the RZ6 we have BIOX, which is a RPvdsEx file with an Matlab toolbox.

Sometimes MOTU DSP's are used.

BIOX

BIOX (BIOphysics eXperiment software) is a Matlab interface for the RZ6. The sofware is available on Gitlab

Embedded systems

Some embedded systems like arduino, and raspberry Pi's are programmed in C++.

Some examples are:

  • Digital event recorder
  • 16 channel two color Led controller
  • Trigger distributor (Sphere Lab)
  • Sock vibrator

Arduino

Arduino devices or compatible embedded CPU's are programmed with the Arduino IDE. The programming language is C++.

Raspberry Pi

<todo>