Coding and simulation
In the raspberry pi 3 we install the noobs operation system. Noobs is an easy operating system installer which contains Raspbian. Raspbian is the Foundation’s official supported operating system. The raspberry pi 3 platform provides software to program. These instructions are written using the python language. Python is a general-purpose programming language, which is another way to say that it can be used for nearly everything. Most importantly, it is an interpreted language, which means that the written code is not actually translated to a computer-readable format at runtime. Whereas, most programming languages do this conversion before the program is even run. This type of language is also referred to as a “scripting language” because it was initially meant to be used for trivial projects.
Noobs is way to make setting up a raspberry pi for the first time much, much easier. You won’t network access, and you won’t need to download any special imaging software. Just head to the downloads page, grab a copy of the noobs zip file, the unpeak it onto a freshly formatted 4GB (or larger) SD card. When you bppt up for the first time, you’ll see a menu prompting you to install our of several operating systems into the free space on the card. The choice means you can boot the pi with a regular operating system like raspbain, or with a media-center specific OS like RaspBMC. Once you have installed an operating system, your pi will boot as normal. However noobs stays resident on your card, so by holding shift down during boot you can return to the recovery interface. This allows you to switch to a different operating system, or overwrite a corrupted card with fresh install of the current one. Its provide a handy toll to let you edit the config.txt.configuration file for the currently installed operating system, and even a web browser so you can return to the recovery interface. This allows you to switch to different operating system, or overwrite a corrupted card with a fresh install of the current one. Its also provides a handy tool to let you edit the config.txt.xonfiguration file for the currently installed operating system, and even a web browser so you can visit the forums or google for pointers if you get stuck.
In technical terms, Python is an object-oriented, high-level programming language with integrated dynamic semantics primarily for web and app development. It is extremely attractive in the field of Rapid Application Development because it offers dynamic typing and dynamic binding options.
Python is relatively simple, so it’s easy to learn since it requires a unique syntax that focuses on readability. Developers can read and translate Python code much easier than other languages. In turn, this reduces the cost of program maintenance and development because it allows teams to work collaboratively without significant language and experience barriers.
Additionally, Python supports the use of modules and packages, which means that programs can be designed in a modular style and code can be reused across a variety of projects. Once you’ve developed a module or package you need, it can be scaled for use in other projects, and it’s easy to import or export these modules.
One of the most promising benefits of Python is that both the standard library and the interpreter are available free of charge, in both binary and source form. There is no exclusivity either, as Python and all the necessary tools are available on all major platforms. Therefore, it is an enticing option for developers who don’t want to worry about paying high development costs.
If this description of Python over your head, don’t worry. You’ll understand it soon enough. What you need to take away from this section is that Python is a programming language used to develop software on the web and in app form, including mobile. It’s relatively easy to learn, and the necessary tools are available to all free of charge.
That makes Python accessible to almost anyone. If you have the time to learn, you can create some amazing things with the language.
Python is a general-purpose programming language, which is another way to say that it can be used for nearly everything. Most importantly, it is an interpreted language, which means that the written code is not actually translated to a computer-readable format at runtime. Whereas, most programming languages do this conversion before the program is even run. This type of language is also referred to as a “scripting language” because it was initially meant to be used for trivial projects.
The concept of a “scripting language” has changed considerably since its inception, because Python is now used to write large, commercial style applications, instead of just banal ones. This reliance on Python has grown even more so as the internet gained popularity. A large majority of web applications and platforms rely on Python, including Google’s search engine, YouTube, and the web-oriented transaction system of the New York Stock Exchange (NYSE). You know the language must be pretty serious when it’s powering a stock exchange system.
In fact, NASA actually uses Python when they are programming their equipment and space machinery. Pretty neat, right?
Python can also be used to process text, display numbers or images, solve scientific equations, and save data. In short, it is used behind the scenes to process a lot of elements you might need or encounter on your device(s) – mobile included.
4.5Benefits of Learning Python
There are many benefits of learning Python, especially as your first language, which we will discuss.It is a language that is remarkably easy to learn, and it can be used as a stepping stone into other programming languages and frameworks. If you’re an absolute beginner and this is your first time working with any type of coding language, that’s something you definitely want.
Python is widely used, including by a number of big companies like Google, Pinterest, Instagram, Disney, Yahoo!, Nokia, IBM, and many others. The Raspberry Pi – which is a mini computer and DIY lover’s dream – relies on Python as it’s main programming language too. You’re probably wondering why either of these things matter, and that’s because once you learn Python, you’ll never have a shortage of ways to utilize the skill. Not to mention, since a lot of big companies rely on the language, you can make good money as a Python developer.
developed. Millions of like-minded developers work with the language on a daily basis and continue to improve core functionality. The latest version of Python continues to receive enhancements and updates as time progresses. This is a great way to network with other developers.
Thonny is the python programming software. Which is use is raspberry pi .with the help of this we run ir camera program and its start camera at start up program. Shown in fig(1.14)
Fig 1.14:Thonny home page
4.7Frequently used commands
sudo Gives the root privileges.
raspi-config Enters to the Raspi configuration menu.
startx Starts the graphical environment.
reboot Reboots the system.
shutdown Shutdown the system.
cd Change a directory.
Cp Copy the file.
rm Remove the file.
mkdir Create a directory.
rmdir Remove a directory.
mv Change the name of directory.
ls Short listing of directory contents.
chown Change the file owner and group.
Chmod Change the file access permissions.
ifconfig Query and configuration of TCP/IP network settings.
Cat Reads the content of a file.
Crontab Opens the cron table.
4.8Connect IR camera
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.led = False
camera.resolution = (640,480)
camera.framerate = 5
camera.sharpness = 0
camera.contrast = 0
camera.brightness = 50
camera.saturation = 0
camera.ISO = 0
camera.video_stabilization = False
camera.exposure_compensation = 0
camera.exposure_mode = ‘auto’
camera.meter_mode = ‘average’
camera.awb_mode = ‘auto’
camera.image_effect = ‘none’
camera.color_effects = None
camera.rotation = 0
camera.hflip = False
camera.vflip = False
camera.crop = (0.0, 0.0, 1.0, 1.0)
print(“show web cam”)
#camera.start_preview() # if need fullscreen use later
camera.start_preview(fullscreen=False, window = (100, 100, 640, 480))
MYINPUT = input(“stop and take picture”) # will wait for answer and show CAM forever
print(“use gpicview to see Pictures/RPI_CAM_py_image.jpg”)
4.9Start pi camera at start up
show web cam
^CTraceback (most recent call last):
File “/home/pi/projects/RPI_CAM/RPI_CAM.py”, line 29, in <module>