Lesson goal: Read the temperature of and plot it in real time

Previous: Your work area temperature | Home | Next: Real time temperature plot (nicer)

As seen in the last lesson, you saw how to read voltages in from the Arduino, which were generated from the LM35DZ temperature probe. Let's do the same in this lesson, but let's make a real-time graph of the temperature as it comes in.

As you run this lesson, try to change the temperature (with ice, your warm breath, a match, pinch in your fingers, etc.) and watch the plot go up and down in response. Pretty cool huh?

Now you try. Go for it! Fix the analogread argument, and be sure that tempF gets computed as the temperature in $^\circ F$.

Type your code here:


See your results here:

See this lesson for the circuit needed. The zoom variable in the code above can make the temperature changes on the graph a bit more dramatic. Running x from -225 to 225 spans the entire horizontal range of the plot area--use this variable as the horizontal plot coordinate. Dismiss.
Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.