DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Get and Store Temperature From a Raspberry Pi With Go

4 years ago dzone.com
Get and Store Temperature From a Raspberry Pi With Go

Summary: This is a summary of an article originally published by the source. Read the full original article here →

by You will learn: And we’ll do it all with Go.

Next, we need to do three things for the temperature sensor: So in our main func, we’ll initialize it: Then we’ll create our new DHT reader: Notice I’m using the GPIO we set in the const above, and calling NewDHT and setting the parameter to Fahrenheit.

Then we store the data from the JSON in our database by passing it to the saveToDatabase function we just created.

Our API is so simple we could write it out by hand, but by using Gin we can expand it and make it more robust later.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com