The data collected from the sensors can be sent to the cloud (https://firebase.google.com/) via Raspberry Pi. A sample c

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

The data collected from the sensors can be sent to the cloud (https://firebase.google.com/) via Raspberry Pi. A sample c

Post by answerhappygod »

The Data Collected From The Sensors Can Be Sent To The Cloud Https Firebase Google Com Via Raspberry Pi A Sample C 1
The Data Collected From The Sensors Can Be Sent To The Cloud Https Firebase Google Com Via Raspberry Pi A Sample C 1 (94.26 KiB) Viewed 45 times
The data collected from the sensors can be sent to the cloud (https://firebase.google.com/) via Raspberry Pi. A sample code is provided as below: except TypeError: print("Type Error occurs") except IOError: print("IO Error occurs") from time import * from grovepi import * from grove_rgb_lcd import * from pyrebase import pyrebase (1) ( Describe the function of apikey. (4 marks) (ii) dhtsensor = 7 pinMode(dhtsensor,"INPUT") Describe the function of following lines dhtsensor = 7 pinMode(dhtsensor,"INPUT") (2 marks) (iii) Describe the function of the following lines set RGB(0,255,0) setText("Temp =" + t + "337' +"c Hum="+h+ "%") (3 marks) config = { "apiKey": "AIzaSyA8bxj8fXZAsiZ7DhPn3dd1XlyzdHWgmle", "authDomain": "bait-iot-4b0b0.firebaseapp.com", "databaseURL": "https://bait-iot-4b0b0.firebaseio.com", "storageBucket": "bait-iot-4b0b0.appspot.com" 3 firebase = pyrebase.initialize_app(config) auth = firebase.auth user = auth.sign_in_with_email_and_password("[email protected]","xxxx") db = firebase.database() (iv) Identify which lines of the code are responsible for sending the data to cloud. (4 marks) while True: try: time.sleep(5) [temp, hum] =dht(dhtsensor,0) print("Temp=", temp,"\u00b0c', "Hum=", hum,"%") t-str(temp) h =str(hum) setRGB(0,255,0) set Text("Temp =" +t+ "337' +"c Hum="+h+ "%") datal ={"temperature":t} data2 = {"humidity":h) results=db.child("PI_001").push(data l,user['id Token']) results= db.child("PI_001").push(data2 user['idToken']) break except KeyboardInterrupt: setText("Program Exited") break
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply