Question: I need to modify the attached code to display data on the LCD adapter for the grovepi+ and save the data to a JSON file.
I need to modify the attached code to display data on the LCD adapter for the grovepi+ and save the data to a JSON file. I also need to change the temperature units to Fahrenheit.
CODE-PYTHON WITH RASBERRY PI
import grovepi import math import json from grove_rgb_lcd import * # Connect the Grove Temperature & Humidity Sensor Pro to digital port D4 # This example uses the blue colored sensor. # SIG,NC,VCC,GND sensor = 4 # The Sensor goes on digital port 4. # temp_humidity_sensor_type # Grove Base Kit comes with the blue sensor. blue = 0 # The Blue colored sensor. white = 1 # The White colored sensor. setRGB(0,255,0) try: while True: try: # This example uses the blue colored sensor. # The first parameter is the port, the second parameter is the type of sensor. [temp,humidity] = grovepi.dht(sensor,blue) if math.isnan(temp) == False and math.isnan(humidity) == False: print("temp = %.02f C humidity =%.02f%%"%(temp, humidity)) except IOError: print ("Error") Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
