Learning Robotics Using Python
Author:Joseph, Lentin
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2015-05-26T16:00:00+00:00
The following code is the loop() function, which continuously reads the sensor value and prints its values through the serial port: The Update_MPU6050() custom function is responsible for printing the updated value from MPU 6050:
void loop() { //Update MPU 6050 Update_MPU6050(); }
The definition of Update_MPU6050() is given as follows. It declares six variables to handle the accelerometer and gyroscope value in 3-axis. The getMotion6() function in the MPU 6050 class is responsible for reading the new values from the sensor. After reading, it will print via the serial port:
void Update_MPU6050() { int16_t ax, ay, az; int16_t gx, gy, gz; // read raw accel/gyro measurements from device accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); // display tab-separated accel/gyro x/y/z values Serial.print("i");Serial.print("\t"); Serial.print(ax); Serial.print("\t"); Serial.print(ay); Serial.print("\t"); Serial.print(az); Serial.print("\t"); Serial.print(gx); Serial.print("\t"); Serial.print(gy); Serial.print("\t"); Serial.println(gz); Serial.print("\n"); }
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Computer Vision & Pattern Recognition | Expert Systems |
Intelligence & Semantics | Machine Theory |
Natural Language Processing | Neural Networks |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8280)
Test-Driven Development with Java by Alan Mellor(6630)
Data Augmentation with Python by Duc Haba(6531)
Principles of Data Fabric by Sonia Mezzetta(6298)
Learn Blender Simulations the Right Way by Stephen Pearson(6184)
Microservices with Spring Boot 3 and Spring Cloud by Magnus Larsson(6056)
Hadoop in Practice by Alex Holmes(5957)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5801)
RPA Solution Architect's Handbook by Sachin Sahgal(5446)
Big Data Analysis with Python by Ivan Marin(5310)
The Infinite Retina by Robert Scoble Irena Cronin(5148)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5135)
Pretrain Vision and Large Language Models in Python by Emily Webber(4276)
Infrastructure as Code for Beginners by Russ McKendrick(4037)
Functional Programming in JavaScript by Mantyla Dan(4035)
The Age of Surveillance Capitalism by Shoshana Zuboff(3941)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3749)
Embracing Microservices Design by Ovais Mehboob Ahmed Khan Nabil Siddiqui and Timothy Oleson(3552)
Applied Machine Learning for Healthcare and Life Sciences Using AWS by Ujjwal Ratan(3527)
