You are on page 1of 4

Programmer

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!

# A Basic Python Program

# Declare some variables first


name = ""
age = 0
currentYear = 0
yearBorn = 0
# ----------------------------------
# Start by getting the users details
name = input("Enter your name: ")
age = int(input("Enter your max age this year: "))
currentYear = int(input("What is the current year? : "))

# ----------------------------------
# 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.

C and C++ Programming


C is a natural alternative for Raspberry Pi programming. It is very powerful, usable on almost all
hardware platforms, and very similar to many other programming languages, such as Java, PHP, C#, and
C-target. As common programming languages are as strong as they are, only the assembler beats them in
terms of programming to a hardware platform's bare metal. That is also what is written on Linux itself.
The notes focus primarily on C and C++ programming and we usually do this on the Raspbian operating
system. Don't think too much about the difference between C and C++ if you are a novice. In a C++
project, you can just start programming using C and then switch into using the fancier C++ concepts-you
don't have to pick one or the other at the beginning. You can trigger problems by also using straight C
once you start using some of the higher-level features of C++, but by the time you are comfortable doing
it you should have learned enough about the language to prevent those kinds of problems, so don't think
about it at the beginning. Raspberry PI resources are generally written for Python, but other languages
may be used as a micro-computer. If you know C/C++ (for example, if you come from the world of
Arduino) and do not want to bother learning another language of programming, you can use C/C++ to
program Raspberry Pi.

#include <iostream>

using namespace std;


int main (int argc, char **argv)

cout<<"Hello World" << endl;

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

> const a = [1, 2, 3];

Undefined

> a [ 1, 2, 3]

> a.forEach((v) => {

... console.log(v);

... });

You might also like