Add and monitor control sensors
Linux Format|March 2023
Making sense of the situation, Les Pounder shows us how to use sensors with a robot to get about town!
Les Pounder
Add and monitor control sensors

OUR EXPERT Les Pounder is associate editor at Tom's Hardware and a freelance maker. He blogs about hacks and makes at http://bigl.es.

At the end of part two, we had successfully built our robot from a kit, soldered the motors and tested them using a series of directional commands. To facilitate this, we created our own Python module to make things easier to control and abstract away some of the complexities. In this part, we move on to writing code that takes data from sensors and uses it to give our robot 'brains'.

Sensors, much like our own, provide a means to see and interact with the world around us. We use our eyes to see the world. Robots can see the world around them with OpenCV (Open Computer Vision), which uses machine learning to identify objects and people, and react accordingly. At a more basic level, robots can 'see' using ultrasonic and obstacle sensors. There are so many sensors to choose from it can bewilder even the most seasoned of makers. We've chosen to stick with the most basic forms: infrared, buttons and ultrasonic sensors. The more advanced methods of input and control will come in a future part.

This part can become quite complex - remember, we are working with multiple types of sensors. We will write the code and test each one as we go. We may use them all, or just a few. That is a decision for you. Make your robot as complex or simple as you wish - we will give you the tools and the knowledge to realise it. Start with a single sensor, learn how it works and then apply that knowledge to your build. The online resources have all of the code snippets for you to add to your code, and our robot.py file contains every function for every sensor we create in this tutorial.

Additional features 

هذه القصة مأخوذة من طبعة March 2023 من Linux Format.

ابدأ النسخة التجريبية المجانية من Magzter GOLD لمدة 7 أيام للوصول إلى آلاف القصص المتميزة المنسقة وأكثر من 9,000 مجلة وصحيفة.

هذه القصة مأخوذة من طبعة March 2023 من Linux Format.

ابدأ النسخة التجريبية المجانية من Magzter GOLD لمدة 7 أيام للوصول إلى آلاف القصص المتميزة المنسقة وأكثر من 9,000 مجلة وصحيفة.

المزيد من القصص من LINUX FORMAT مشاهدة الكل
Create your first WebSocket service
Linux Format

Create your first WebSocket service

Mihalis Tsoukalos explains how to use the Go programming language to work with the WebSocket protocol.

time-read
9 mins  |
April 2023
Fantastic Mr Firefox
Linux Format

Fantastic Mr Firefox

Nick Peers takes a trip down memory lane to reveal the story behind the rise - and slight fall - of Mozilla's popular web browser.

time-read
9 mins  |
April 2023
Set up your terminal and email like it's 1983
Linux Format

Set up your terminal and email like it's 1983

Jump in the hot terminal time machine with Mats Tage Axelsson who emails from the command line using the latest technology.

time-read
8 mins  |
April 2023
Universal layer text effects with GIMP
Linux Format

Universal layer text effects with GIMP

Posters use them, films and presentations are hard to imagine without them: text effects. Attract attention with Karsten Günther and GIMP.

time-read
8 mins  |
April 2023
Jump to a federated social network
Linux Format

Jump to a federated social network

Nick Peers reveals how you can get up and running with this free, decentralised and non-profit alternative to Twitter.

time-read
9 mins  |
April 2023
Free our SOFTWARE!
Linux Format

Free our SOFTWARE!

Taking anything for granted is dangerous, so Jonni Bidwell and Mike Saunders revisit how the free software movement got started to help free us from proprietary tyranny!

time-read
4 mins  |
April 2023
Master RPI.GPIO
Linux Format

Master RPI.GPIO

Les Pounder goes back to the early days of the Raspberry Pi - and his career with this classic library! -

time-read
5 mins  |
April 2023
Waveshare Zero to Pi3
Linux Format

Waveshare Zero to Pi3

Transform your Pi Zero into a Pi 3, they promised Les Pounder, but it's more like adding on go-faster stripes.

time-read
2 mins  |
April 2023
The Best OPEN SOURCE Software Ever!
Linux Format

The Best OPEN SOURCE Software Ever!

In an attempt to trigger controversy, Michael Reed and Neil Mohr unequivocally state these are the greatest free software apps ever. Probably. We’re just trying to be helpful.

time-read
10+ mins  |
April 2023
Linux-Mandrake 7
Linux Format

Linux-Mandrake 7

Simplicity and a wide range of applications make this a great distribution for all Linux users.

time-read
2 mins  |
April 2023