Coding of LDR sensor
Lesson-9 ->How to interface LDR sensor with Arduino Uno in Tinkercad
Coding of LDR sensor
Steps to do coding in Tinkercad
1. Click the code editor button to open the coding panel.
Now to code LDR sensor,
First, we will make a variable named as
“sensorvalue”
.
We are making this variable to store the data or signal coming from the LDR sensor i.e from AO pin of Arduino Uno.
Now, Let us print the value coming from the LDR sensor in the serial monitor using
print to serial monitor block.
In the end,map the value coming from the LDR sensor to a range between 0 to 255 and in accordance to the range the LED will Glow.
The code is shown below:
Back to Lesson
Login
Accessing this course requires a login. Please enter your credentials below!
Username or Email Address
Password
Remember Me
Lost Your Password?
Register
Don't have an account? Register one!
Register an Account