Skip to Content
Learning Robotics using Python - Second Edition
book

Learning Robotics using Python - Second Edition

by Lentin Joseph
June 2018
Beginner to intermediate
280 pages
6h 58m
English
Packt Publishing
Content preview from Learning Robotics using Python - Second Edition

Interfacing Code of Tiva C Launchpad

The following Energia code for Launchpad reads values from the ultrasound sensor and monitors the values through a serial port.

The following code defines the pins in Launchpad to handle ultrasonic echo and trigger pins and also defines variables for the duration of the pulse and the distance in centimeters:

const int echo = 9, Trig = 10; 
long duration, cm; 

The following code snippet is the setup() function. The setup() function is called when the program starts. Use this to initialize variables, pin modes, to start using libraries, and so on. The setup function will only run once, after each power up or reset of the Launchpad board. Inside setup(), we initialize serial communication with a baud rate ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Robotics using Python

Learning Robotics using Python

Lentin Joseph
Python Robotics Projects

Python Robotics Projects

Prof. Diwakar Vaish

Publisher Resources

ISBN: 9781788623315Supplemental Content