Professional Documents
Culture Documents
The process of instructing computers to carry out tasks is programming. It is also referred to as coding.
And the user who execute is programmer. Any system capable of processing code is the computer in the
description above. To name a couple, these may be tablets, ATMs, the Raspberry Pi, servers. In our group
assignment we discussed about the Raspberry PI.
Now let’s have some more detailed information on programming or coding of Raspberry PI. There is a
high probability that you can compile or translate any language of your choice, like C, C++, PHP, and
Ruby, using your Raspberry Pi. Digital Studio Code from Microsoft runs on the Raspberry Pi as well. It's
a Microsoft open-source code editor that supports multiple languages for markup and programming.
Python
Python is a great and versatile programming language that is easy to use (easy to read and write) and can
connect your project to the real world with Raspberry Pi. To prepare you for programming on the
Raspberry Pi, we present the fundamentals of the Python programming language. Many languages can be
used, but Python is the most convenient for the Raspberry Pi since simple operations such as pin control
are supported with convenient APIs. Python is a powerful language that we are going to present with
useful features so that you can monitor the Raspberry Pi using these features. In the Raspberry Pi OS
files, not all Python packages are available and those that are can often be out of date. You can install
packages from the Python Package Index if you can't find an acceptable version in the Raspberry Pi OS
archives (known as PyPI). Files uploaded by package maintainers are hosted by the official Python
Package Index (PyPI). In order to install them, some packages require compilation (compiling C/C++ or
similar code), which can be a time-consuming process, especially on a single-core Raspberry Pi 1 or Pi
Zero. Unlike other languages (C, C++, etc.), Python is an interpreted language, meaning that an
interpreter reads the Python instructions when a Python program is run and then performs the desired
action. In CPU native instructions, the interpreter itself is written, but the Python program is not.
With an OS like Raspbian, which is designed for programmers of all sorts, having Python programs to run
on the Raspberry Pi is extremely easy. Another big benefit of using Python on a Pi is that when it's ready
to run, you can write the program on a different machine (such as Windows) and then pass the program to
a Pi. Just note, though, that some Python code is special to the Pi, with GPIO only for the Pi!
# ----------------------------------
# Perform a basic calculation
yearBorn = currentYear - age
# ----------------------------------
# Print the result
print ("You were born in the year " + str(yearBorn))
It is time to run the program with the code entered and the file saved. It is possible to run a
Python program in one of three ways: press F5 in the program window to run, go to the menu bar
and select Run > Python Shell, or run the file as a Python argument through a terminal window.
The best approach for now is to simply press F5 with the code in the browser. The code should
return no errors once pressed, and the shell window should prompt for data.
#include <iostream>
return 0;
Before being executed, the C ++ program must be compiled. Select 'Build' from the 'Build' menu, or
directly press F9 to compile the code. Then, select "Execute" from "Build" or press F5 to run the code.
JavaScript
JavaScript is a language designed for programming. To be helpful, this code has to be run by something.
In web browsers, JavaScript is used most often to render websites interactive and easier to use. Also,
much like Python, you can run JavaScript on the command line. The program is called Node.js, which
manages this. Node.js is not built on Raspbian by default, unlike Python, and different versions are
available for different hardware versions. JavaScript is a great programming language that runs
everywhere. JavaScript primarily runs on your web browser; however, people are finding great uses for
the language in other places. While Python is the primary language associated with the Raspberry Pi, we
can use JavaScript to control the Raspberry Pi's GPIO and provide some IoT web-enabled functionality.
Example
$ node
Undefined
> a [ 1, 2, 3]
... console.log(v);
... });