Skip to Content
Python Programming for Arduino
book

Python Programming for Arduino

by Pratik Desai
February 2015
Intermediate to advanced
400 pages
9h 49m
English
Packt Publishing
Content preview from Python Programming for Arduino

Plotting data from a CSV file

At the beginning of the chapter, we created a CSV file from Arduino data. We will be using that SensorDataStore.csv file for this section. If you recall, we used two different sensors to log the data. Hence, we have two arrays of values, one from a digital sensor and another from the analog one. Now, in the previous example, we just plotted one set of values for the y axis. So, how are we going to plot two arrays separately and in a meaningful way?

Let's start by creating a new Python program using the following lines of code or by opening the plotCSV.py file from this chapter's code folder:

import csv from matplotlib import pyplot i = [] mValues = [] pValues = [] with open('SensorDataStore.csv', 'r') as f: reader = ...
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

Python Programming with Raspberry Pi

Python Programming with Raspberry Pi

Srihari Yamanoor, Sai Yamanoor

Publisher Resources

ISBN: 9781783285938Supplemental Content