Final Project error

I m doing final project using ldr and lm35…i know that we cant use them both at single a0 so i kept ldr to a0 and lm35 to digital pin and wrote analogRead and can somebody view the code and connections and i mseeing this error someone help me clear out this…if anyone is ready kindly help me in completing this project

5v- lm35
1-one led(+ve)
2-lm35(digutal as analog pin)
3-shorted 2nd led positive and resistor and connected resitor other end at 3

If somebody helps me i wud complete this project…kindly do me this favour![

hello help me plz

No output on running? Add a print statement above def smart_home_mode(): and run to check if the python is at least reading the code.

1 Like

Actuallu LM35 is a output device which gives you a analog sensor value andi think you are not suppose to put the lm35 output to GPIO pin

yeah bro its working…i gave a print statement above def and only that is running

and yesterday initially the complete code had run properlly and it had shown few errors i rectified it and later after the clearance of errors it didnt show anything

yeah i too felt the same, thats why i tried writing it as analogRead…

isnt that writing the code in this way mgt be the reason for not running the code properly

Your whole code is under a the function def smart_home_mode(): But you are not calling it.

Below the whole code type smart_home_mode(). And it will run.

1 Like

:sweat_smile:yes bro thank u
Mrng i removed function statement and i had run the code it just continuously run only for ldr and so i made few changes for the code and kept function statement again
Now the error is

You have to wait for the given time. You have reached your API rate limit.

For more information -

oh ok bro its showing invalid literal int what abt that

bro until then will u see my code like my idea is when button gets on smart home mode must be on and it sees lgt intensity and switches light on and off
nand later temp if its hot its switches ac and if its cool its switches off and when it crosses threshold it gives us fire alert
and when button is off mode shud be off

bro can i get ur contact email or mob…if not here i requested u in linkedin if u dont mind can u share ur contact there

Solution - add time.sleep(10) under every response and request. It will delay using API with 10 seconds.

There are over 10-15 API you are using every 10 seconds currently.

1 Like

bro ldr is working but temperature is not working its showing temp is 0

in this project the person used both ldr and lm35

Because you are using digitalRead. LM35 is gives analog output. You are hampering the module by providing 5v to 3v GPIO pin.

1 Like

The project has used LDR on digitalRead. Write the code so that, it reads

if ( digitalRead(1) == LOW){ 
    //do the job
1 Like

i didnt get u bro…
can u help me writing the code

Bro do me this favour plz…in writing the code

Take your time and keep trying. If I provide you with the code for the final project, how will it help you in future?

From your code, it looks like its working fine, without any error. What’s the issue?

whatever u said is right but plz help me na
i hv been struggling since 2 days
but the temperature is not recording properly thats why

LM35 and LDR both are analog sensors. It gives off analog output from its signal pin.

For LDR, Voltage that passes through 5V has a resistance from the light. So, the value fluctuates between 0v to 5v. We see the value between 0 to 1024.
For LM35, Voltage passes with increasing temperature. So it fluctuates between 0v to 5v.

Now, digitaloutput sensors, like switch, IR sensor, has values either 1 or 0.

Using analog sensors but trying to read with digitalRead wont help.

Show your new code. Message service was working right? You made changes in the code?

To use 2 analog sensors together, you can use Arduino. It is 6 analog pins, A0 TO A5.