Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Raspberry Pi Sensors
  • Toc
  • feedback
Raspberry Pi Sensors

Raspberry Pi Sensors

By : Rushi Gajjar
4.4 (9)
close
Raspberry Pi Sensors

Raspberry Pi Sensors

4.4 (9)
By: Rushi Gajjar

Overview of this book

This book is perfect for hardware enthusiasts who want to develop amazing projects using Raspberry Pi. Some knowledge and experience working with Linux, C, and Python is a plus, but once you're set up to go, you'll be ready to push the creative capabilities of your Raspberry Pi even further.
Table of Contents (10 chapters)
close
9
Index

Practice makes you perfect

This section includes some practice problems, which should be exercised with shell, C, and Python. The reason behind this practice is that it will make you stronger in understanding the problems and logic of programs, which can really help you to easily make the sensor project. This practice will not cover or give you the idea of entire language or script, but will make you comfortable enough to understand the codes used in the next chapters.

I advise you to connect the Raspberry Pi through an Ethernet cable with your PC, and use the methods stated in the preceding sections to execute the programs. You can take help of the Internet (www.cprogramming.com/quiz/) to understand the logic and the syntax. The problem statements shown here should be attempted in all three languages/scripts, which will give you enough idea to work with scripts and languages:

  • Write a program to get all Armstrong numbers below 1000. Note that among three digit numbers, an Armstrong number is equal to the sum of the cubes of its digits. For example, 153 is an Armstrong number because 153 = 13+ 53+33.
  • Convert the temperature value from degrees Celsius to degrees Fahrenheit and vice versa. Ask user to get the value and decide whether they are entering it in Celsius or Fahrenheit. Show a warning message if the temperature is above 38 degrees Celsius or 100 degrees Fahrenheit.
  • Create a calculator that has all the basic functionalities, such as addition, subtraction, division, and multiplication. Ask the user to select the function they want. Show an error if they divide anything by zero.
  • Get a time value from the clock, attach to a Time is string, and display the current time, for example, Time is 17-Oct-14 10:18:22AM.

The skills acquired by performing these exercises will allow you to better understand the projects in the upcoming chapters. You can expect an easy programming level in upcoming chapters. These chapters will focus more on Python and C programs. Hence, more practice on programs will help you gain a better understanding of the language and increase logical thinking.

bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete