Simulated circuits in Arduino Using Tinkercad

anoushka srivastava
ReadWriteRead
Published in
17 min readOct 16, 2021
  • By Anoushka Shrivastav, Siddhant & Sai Nishith
img : arduino simulations in tinkercad without hardware.

Introduction

In this article, we would be performing various experiments on an Arduino microcontroller using an online simulation platform; Tinkercad is a free online collection of software tools that help people all over the world think, create and make.

About Arduino Uno

Arduino. cc created the Arduino Uno, an open-source microcontroller board based on the Microchip ATmega328P microcontroller. The board has several digital and analogue input/output (I/O) pins that can be used to connect to different expansion boards (shields) and other circuits. The board features 14 digital I/O pins (six of which are capable of PWM output), 6 analogue I/O pins, and is programmable through a type B USB cable using the Arduino IDE (Integrated Development Environment). It can be powered by a USB cable or an external 9-volt battery, with voltages ranging from 7 to 20 volts.

Exp 1: Multiple LEDs & Breadboards with Arduino in Tinkercad

Objective : This experiment aims at connecting multiple LEDs to an Arduino board via a breadboard; a special plastic board with various holes connected internally to connect electrical components to an arduino in a neat manner.

Circuit:

An arduino circuit with a breadboard, 3 LEDs and 3 resistors to blink the 3 LEDs
An Arduino circuit with a breadboard, 3 LEDs and 3 resistors to blink the 3 LEDs

Simulation : (link for the simulation video) and tinker link of the experiment.

tinker link for exp 1(given below) :

tinkerlinkexp1

Component list of the arduino circuit
Component list of the circuit

Code:

// C++ code
//
int animationSpeed = 0;

void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
}

void loop()
{
animationSpeed = 200;
digitalWrite(13, HIGH);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(13, LOW);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(12, HIGH);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(12, LOW);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(11, HIGH);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(11, LOW);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
}

Code explanation:

animationSpeed : variable that controls the speed of the blinking of led(s); set to 200 milliseconds.

Setup part:

pinmode(): function used to access the LEDs by their pin no.(s) and passing arguments like ‘INPUT’/’OUTPUT’ to make them work as input/output pins resp.

Loop part:

digitalWrite(): used to change the state of the LED to HIGH(on)&LOW(off) resp. by passing its pin no.

So basically the code makes the LED on the 13th digital I/O pin glow and waits for animationSpeed; i.e. 200 millisecs, and then turns it off ,waits for another 200 ms & then the same case happens with LEDs on pin 12& 11 resp. This process happens on a continuous loop to create a blinking effect.

delay(): part of loop part; function used to delay the on and off process of the LEDs by “animationSpeed” =200 milliseconds

//: for displaying single line comments

/*…*/: to display multi-line comments

{..} : contains loops (i.e. statements which are repeated continuously.

EXP2: Fading LED with Arduino Analog Output in Tinkercad

Objective : The experiment aims at creating a light fading effect in an LED connected to an arduino. The oscillating digital signals coming to the LED by the arduino would be shown by an oscilloscope & and the dropping & raising voltage in the LED would be shown by a voltage multimeter. {This is an eg of “Pulse Width Modulation” or (PWM) in short; where the brightness & dimness of LED depends on the ratio of it being ON:OFF.}

Circuit:

arduino circuit for fading an LED
arduino circuit for fading an LED

Simulation (link of simulation video of the exp; and the Tinkerlink of the experiment):

Tinkerlink or Exp 2 given below::

tinkerlinkexp2

Component list for exp 2
component list of EXP2

Code:

// C++ code
//
int brightness = 0;

void setup()
{
pinMode(9, OUTPUT);
}

void loop()
{
for (brightness = 0; brightness <= 255; brightness += 5) {
analogWrite(9, brightness);
delay(30); // Wait for 30 millisecond(s)
}
for (brightness = 255; brightness >= 0; brightness -= 5) {
analogWrite(9, brightness);
delay(30); // Wait for 30 millisecond(s)
}
}

explanation:

Setup part

brightness : variable that decides the brightness level of the LED

pinmode(): used to call LED on pin 9 as an output pin to give analog output

Loop part

in loop 1{LED FADES UP}: brightness moves from 0–255, with 5 being added repeatedly to it

analogWrite(): Used to get desired analog output (light fading) from LED on pin 9 till the duration of the loop.

delay(): delay fading up & down of the LED by 30 sec for the proper functioning of the simulation.

in loop2{LED FADES DOWN}:reverse happens, brightness reverse counts from 255–0, & 5 keeps subtracting from it.

analogWrite(): Used to get desired analog output from LED on pin 9 till the duration of the loop here also.

delay(): delay fading up & down of the LED by 30 sec for the proper functioning of the simulation.

The oscillating digital signals coming to the LED by the arduino shown by an oscilloscope & and the dropping & raising voltage in the LED shown by a voltage multimeter.

//: for displaying single line comments

/*…*/: to display multi-line comments

{..} : contains loops (i.e. statements which are repeated continuously.

EXP 3: Digital Input with a Pushbutton with Arduino in Tinkercad

Objective: To take digital input from a push button connected to an arduino to turn an LED on & off resp. on its pressing . LED connected to whole setup. Dropping & raising voltage in the LED on pressing the button would be shown by a voltage multimeter.

Circuit:

arduino circuit to get digital output from a push button resulting in the lighting up and down of a connected LED on its pressing & releasing resp.
Arduino circuit to get digital output from a push-button resulting in the lighting up and down of a connected LED on its pressing & releasing resp.

Simulation (link of simulation video of the exp; and the tinkerlink of the experiment):

Tinkerlink for exp 3 given below:

tinkerlinkexp3

components for exp 3
components for exp 3

Code:

// C++ code
//
int buttonState = 0;

void setup()
{
pinMode(2, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
// To read the state of push-button
buttonState = digitalRead(2);
// check if the push button is pressed, if it is,
// then the button state is HIGH
if (buttonState == HIGH) {
digitalWrite(LED_BUILTIN, HIGH);
} else {
digitalWrite(LED_BUILTIN, LOW);
}
delay(10); // Delay a little bit to improve simulation performance
}

Explanation:

buttonState: variable to denote the state of pin 2( to which button is connected, whether it is HIGH or LOW), i.e. the button is pressed or not.

Setup part:

pinmode():used to call button on pin 2 as an INPUT pin to get digital output of pressing & the LED on pin 13 as an OUTPUT pin to get its lighting output.

Loop part:

digitalWrite(): reads state of pin 2 as the state of the push button. ie. if the button the pressed , then the pin state is HIGH, else it is LOW.

if buttonState is high:

digitalWrite():sets LED to HIGH(ON)

else:

digitalWrite():sets LED to LOW(OFF)

delay(): Causes delay of 10secs b/w LED ON&OFF for good simulation performance.

//: for diplaying single line comments

/*…*/: to display multi-line comments

{..} : contains loops (i.e. statements which are repeated continuously.

Exp4: TMP36 Temperature Sensor with Arduino in Tinkercad

Objective : To surrounding temperature of an arduino board using a TMP36 temperature sensor up to a specified range and flashing green, yellow & yellow LED lights to indicate low, medium & high temperatures resp.

Circuit:

ciruit of sensing temperature through an arduino using a TMP36 temperature sensor and flashing resp. LED lights to indicate low, medium & high temperatures.
ciruit of sensing temperature through an Arduino using a TMP36 temperature sensor and flashing resp. LED lights to indicate low, medium & high temperatures.

Simulation (link of simulation video of the exp; and the tinkerlink of the experiment):

Tinkerlink of exp 4 given below:

tinkerlinkexp4

components of Exp4
components of Exp4

Code:

// C++ code
//
int temp = 0;

void setup()
{
pinMode(A0, INPUT);
Serial.begin(9600);

pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
}

void loop()
{
temp = map(((analogRead(A0) — 20) * 3.04), 0, 1023, -40, 125);
// map function to map the range of temp sensor
// from raw analog output to output in degree
// celsius b/w (-40 to 125 C) using formula t= (a
// -20)(3.04), a =analog signal in numbers, t=
// corressponding temperature value
Serial.println(temp);
if (temp < 25) {
digitalWrite(4, HIGH);
digitalWrite(3, LOW);
digitalWrite(2, LOW);
Serial.println(“low temperature”);
}
if (temp >= 25 && temp < 50) {
digitalWrite(4, LOW);
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
Serial.println(“medium temperature”);
}
if (temp >= 50 && temp <= 125) {
digitalWrite(4, LOW);
digitalWrite(3, LOW);
digitalWrite(2, HIGH);
Serial.println(“high temperature”);
}

1–1;
delay(10); // Delay a little bit to improve simulation performance
}

Explanation:

temp=variable that stores the temperature recorded by the temperature sensor.

Setup part:

pinmode():used to call on LEDs on pins 2,3 & 4 as OUTPUT pins to give lighting output; and to call temperature sensor connected to analog pin A0 as an INPUT pin to give “temperature” input.

Serial.begin(): function used to start serial monitor to print the temperature recorded & whether it is low, medium or high on it.

Loop part:

map(): used to map the value of temp variable & convert its range from analog output from temperature to converted value in degree celsius ranging from -40 to 125 degree celsius.

Serial.println(): to print value of recorded temperature stored in variable temp on the serial monitor. Each value is printed in a new line.

digitalWrite():used to set LED on desired pin to HIGH or LOW.

if temperature<25 degrees C

digitalWrite() function turns on green light & ‘low temperature’ & recorded temperature is printed on serial monitor.

if temperature is b/w 25 to 50 degrees C

digitalWrite() function turns on yellow light & ‘medium temperature’ & recorded temperature is printed on serial monitor.

if temperature is b/w 50 to 125 degrees C

digitalWrite() function turns on red light & ‘high temperature’ & recorded temperature is printed on serial monitor.

delay():delays display of different temperatures by 10 sec for convenience of simulation.

//: for displaying single line comments

/*…*/: to display multi-line comments

{..} : contains loops (i.e. statements which are repeated continuously.

Exp 5: Ultrasonic Distance Sensor in Arduino with Tinkercad

Objective : To measure distance of an object near an arduino up to a specific distance using an ultrasonic distance sensor which uses ultrasonic sound waves to measure distance and uses analog output of the sound waves to give accurate distance output; and to also plot a graph of the distance travelled by the object .

Circuit :

circuit of sensing distance from an arduino using a distance sensor
circuit of sensing distance from an Arduino using a distance sensor
distance readings on serial monitor & distance_travelled_by_object : graph
distance readings on serial monitor & distance_travelled_by_object: graph

Simulation (link of simulation video of the exp; and the tinkerlink of the experiment):

tinker link of exp 5 given below:

tinkerlinkExp5

Components of Exp5 to measure distance of object through arduino using distance sensor
Components of Exp5 to measure the distance of object through Arduino using distance sensor

Code:

// C++ code
//
/*
Code for measuring distance using arduino &
distance sensor
*/

long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT); // Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
// Sets the trigger pin to HIGH state for 10 microseconds
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return pulseIn(echoPin, HIGH);
}

void setup()
{
Serial.begin(9600);

}

void loop()
{
Serial.println(0.01723 * readUltrasonicDistance(11, 10));
delay(500); // Wait for 500 millisecond(s)
}

Explanation:

triggerPin(): variable that stores the analog outputs of the trigger in of distance sensor & monitors its state.

echoPin(): variable that stores the intputs of the trigger in of distance sensor & monitors its state.

reading the trigger pin & the echo pin {of distance sensor & send & receive analog output & input from them} part:

long readUltrasonicDistance(): reads the state of trigger pin & echo pin of the distance sensor & to receive and display the output & input of the resp. pin as an integer.

digitalWrite():sets trigger pin as OUTPUT {to release ultrasonic signal} , first sets it at LOW to clear the trigger, then after 2 µs, again sets it to HIGH for 10µs to send signal then again turns it off.

pinmode(): used to call the echo pin of the distance sensor as an INPUT pin to receive the analog input of reflected back ultrasonic waves from the object whose distance is to be measured.

return pulseIn(): Reads the echo pin, and returns the sound wave travel time in microseconds (µs).

Setup part:

Serial.begin(): Makes the serial monitor ready for printing output.

Loop Part:

Serial.println(0.01723 * readUltrasonicDistance(11, 10)); =used to convert and print the outputs of distance sensor’s trigger & echo pins {in time travelled in microseconds}at pins 11&10 resp. of arduino to corresponding distance of the object from the distance sensor. Each value is printed in a new line.

delay(500)=used to delay the printing of distances on the serial monitor by 500 µs/0.5sec for convenience of the simulation of the program.

//: for displaying single line comments

/*…*/: to display multi-line comments

{..} : contains loops (i.e. statements which are repeated continuously.

Exp 6:Blink an LED With Arduino in Tinkercad by circuits in Arduino

Objective: To make an LED blink continuously by connecting it with an arduino microcontroller by using a pre-made LED blinking circuit in the “Arduino” circuits section in tinkercad.

Circuit:

circuit to blink an LED using arduino
circuit to blink an LED using Arduino

Simulation (link of simulation video of the exp; and the tinkerlink of the experiment):

Tinkerlink of exp 6 given below:

tinkerlinkExp6

components of Exp 6
components of Exp 6

Code:

void setup()

{

pinMode(LED_BUILTIN, OUTPUT);

}

void loop()

{

digitalWrite(LED_BUILTIN, HIGH);

delay(1000);

digitalWrite(LED_BUILTIN, LOW);

delay(1000);

}

Explanation:

LED_BUILTIN: keyword used to access the built_in LED connected to arduino.

Setup part:

pinmode(): function used to access the Built_in LED and passing arguments like ‘INPUT’/’OUTPUT’ to make it work as input/output pin resp.

Loop part:

digitalWrite(): used to change the state of the built_in LED to HIGH(on)&LOW(off) resp. This process happens on a continuous loop to create a blinking effect.

delay(1000)= used to delay the time b/w the turning ON & OFF of the LED by 1sec; for the convenience of the simulation.

//: for displaying single line comments

{..} : contains loops (i.e. statements which are repeated continuously.

EXP 7:RGB LED Colour Mixing with Arduino in Tinkercad

Objective : To mix the colors of an LED connected to an arduino using an RGB LED ; i.e. to make the same LED blink in different colors simultaneously through an arduino microcontroller.

Circuit:

circuit of RGB colour mixing through arduino on tinkercad
circuit of RGB colour mixing through Arduino on Tinkercad

Simulation (link of simulation video of the exp; and the Tinkerlink of the experiment):

Tinkerlink of exp 7 is given below:

tinkerlinkExp7

components of Exp 7
components of exp 7

Code:

void setup()

{

pinMode(11, OUTPUT);

pinMode(10, OUTPUT);

pinMode(9, OUTPUT);

}

void loop()

{

analogWrite(11, 255);

analogWrite(10, 0);

analogWrite(9, 0);

delay(1000);

analogWrite(11, 255);

analogWrite(10, 255);

analogWrite(9, 102);

delay(1000);

}

Explanation:

Setup part:

pinmode(): function used to access the LEDs by their pin no(s) and passing arguments like ‘OUTPUT’ to make them work as output pins resp.

Loop part:

analogWrite(): Used to access analog output from Digital I/O pin. Here 1st output is only taken from pin 11, to display only 1 color on the LED

After a delay of 1sec , outputs of different quantities are received at the same time from other 2 pins also , to make the LED blink in the mix of different colors simultaneously.

After another 1 sec, this process again loops/repeats and keeps on looping creating the effect of RGB color mixing in the LED.

delay(1000): used to delay display of other colors by 1sec; for properly creating the RGB color mixing effect & for the convenience of the simulation.

{…} =contains loops, i.e. looping/repeating statements.

Exp 8: Read a Potentiometer with Arduino’s Analog Input

Objective: To read the analog input of a potentiometer by controlling the flashing of a connected LED based on the position of the knob of the potentiometer. Using Arduino’s Analog to Digital Convertor function(ADC), the analog signals of 0–5v coming from the potentiometer are converted to digital signal from 0=1023 millisec to be given to LED as an input to blink, producing an analog output ; The difference in the time of the LED turning OFF & ON = value of voltage coming from the potentiometer at that time. If the potentiometer is giving low voltage reading, then the LED would blink fast(less turning ON & OFF difference ) & if the potentiometer is giving high voltage reading, then the LED would blink slowly (more turning ON & OFF difference )

Circuit:

circuit of reading a potentiometer’s output using an arduino microcontroller
circuit of reading a potentiometer’s output using an Arduino microcontroller

Simulation (link of simulation video of the exp; and the Tinkerlink of the experiment):

tinker link for Exp 8 is given below:

tinkerlinkExp8

components of Exp 8
components of Exp 8

Code:

int sensorValue = 0;

void setup()

{

pinMode(A0, INPUT);

pinMode(13, OUTPUT);

}

void loop()

{

// read the value from the sensor

sensorValue = analogRead(A0);

// turn the LED on

digitalWrite(13, HIGH);

// pause the program for <sensorValue> millseconds

delay(sensorValue); // Wait for sensorValue millisecond(s)

// turn the LED off

digitalWrite(13, LOW);

// pause the program for <sensorValue> millseconds

delay(sensorValue); // Wait for sensorValue millisecond(s)

}

Explanation:

sensorValue: Variable to store the voltage value of the potentiometer where its knob is palced;in integers.

Setup part:

pinMode(): used to call the potentiometer connected to the analog pin A0 as an INPUT pin , to give input value of voltage from the potentiometer; and to set LED at pin 13 as OUTPUT pin to give analog(blinking) output based on potentiometer’s position and its voltage reading.

Loop part:

sensorValue = analogRead(A0);=the variable ‘sensorValue’ containing the voltage reading of the potentiometer would read the analog pin A0 {to which potentiometer is connected}; this function would store potentiometer’s analog output in the form of digital output in this variable.

digitalWrite(13, HIGH); = as soon as the potentiometer is fixed at a position; the LED (pin 13) immediately turns ON

delay(sensorValue) : the LED is ON for ‘sensorValue’ milliseconds, which is based on potentiometer knob’s position & its reading.

digitalWrite(13, LOW); =The LED turns OFF for ‘sensorValue’ milliseconds, and after waiting for this time, it turns on again, & the loop keeps repeating itself; and creates a flashing effect for the LED

The duration of the LED being ON & OFF changes with change in potentiometer’s reading.

And the loop keeps repeating itself & the LED flashes change in the same way as the potentiometer’s knob position & voltage reading is changed .

//: for displaying single line comments

{…} =contains loops, i.e. looping/repeating statements.

Exp 9: Arduino Serial Monitor in Tinkercad

Objective: To print the output on a serial monitor in tinkercad using an arduino ; here connected with a potentiometer, whose analog readings would be printed in the digital format on the serial monitor using arduino’s Analog to Digital Converting function; i.e. ADC.

Circuit:

circuit for printing output on a serial monitor using an arduino connected with a potentiometer
circuit for printing output on a serial monitor using an Arduino connected with a potentiometer

Simulation (link of simulation video of the exp; and the Tinkerlink of the experiment):

tinker link of Exp 8 is given below:

tinkerlinkExp8

Component list of Exp 8
Component list of Exp 8

Code:

int potentiometer=0;

void setup()

{

pinMode(A0,INPUT);

Serial.begin(9600);

}

void loop()

{

potentiometer = analogRead(A0);

Serial.println(potentiometer);

delay(10);

}

Explanation:

potentiometer: A variable that stores the analog readings of the potentiometer in integer format.

Setup part:

pinMode(): used to call the potentiometer connected to the analog pin A0 as an INPUT pin , to give input value of voltage from the potentiometer; i.e. to get voltage reading of potentiometer as an INPUT.

Serial.begin(): Makes the serial monitor ready for printing output {of potentiometer’s reading}.

Loop part :

potentiometer = analogRead(A0); = using analogRead() function , the potentiometer’s analog reading stored in variable, “potentiometer” (ranging from 0 -5v) connected at analog pin A0 ; is read & converted into corresponding digital reading (0–1023 millisecs),which would be printed on the serial monitor.

Serial.println(potentiometer); = Used to repeatedly print the analog — digital converted readings recorded by the potentiometer, & stored in variable “potentiometer” on to the serial monitor. Each value is printed in a new line.

All these processes happen repeatedly ; i.e. on a loop.

delay(10): used to delay the printing of readings on the serial monitor by 10 millisecs; for the the convenience of printing on the serial monitor & for the convenience of the simulation.

{…} =contains loops, i.e. looping/repeating statements

Exp 10: PIR Motion Sensor with Arduino in Tinkercad

Objective : To detect motion of a an object within a specific distance range of an Arduino using a PIR motion sensor & to print the position of the object corresponding to the {analog to digital converted; [ADC]} reading of potentiometer in millisecs and print “motion detected” , on the serial monitor.

Circuit:

Arduino Motion detector circuit using PIR motion sensor
Arduino Motion detector circuit using PIR motion sensor

Simulation (link of simulation video of the exp; and the tinkerlink of the experiment):

tinker link of Exp 10 is given below:

tinkerlinkExp10

Component list of Exp 10
Component list of Exp 10

Code:

int a=0;

int b=0;

void setup()

{

Serial.begin(9600);

}

void loop()

{

a=analogRead(A0);

b=map(a,0,1023,0,255);

Serial.println(b);

if(b>100)

{

Serial.println(“Motion detected”);

delay(100);

}

}

Explanation:

Setup part:

Serial.begin(): Makes the serial monitor ready for printing output {of potentiometer’s reading}.

Loop part :

a= variable to read the analog input (0–5v) of the PIR sensor connected on analog pin A0 of the arduino & to convert it into corresponding digital input of range 0–1023 millisecs and store it as an integer.

b= variable to map the range of variable a from 0- 1023 millisecs to 0 -255 millisecs as an integer.

Serial.println() : Prints the stored value of the PIR sensor reading in ‘b’ on the serial monitor repeatedly. Each value is printed in a new line

if b>100:

Serial.println(“Motion detected”);= Prints “ Motion detected” on the serial monitor repeatedly ; everytime on a new line.

delay(100);=Causes delay of 100 millisecs(= 0.1 sec) b/w the printing of ‘Motion detected’ & the corresponding millisec reading of PIR sensor for the convenience of the simulation & for proper printing on the serial monitor. This whole process happens repeatedly; i.e. in a loop.

{…} =contains loops, i.e. looping/repeating statements

Exp 11: Light Sensor (Photoresistor) With Arduino in Tinkercad

Objective : Is to read the resistance value of a photoresistor in digital format using arduino & to print it on the serial monitor in tinkercad ; a photoresistor is sensitive to light & has less resistance in bright light, & high resistance when their is darkness; i.e. dim/ no light.

Circuit:

circuit of reading a photo resistor using arduino
circuit of reading a photoresistor using Arduino

Simulation (link of simulation video of the exp; and the tinkerlink of the experiment):

tinker link of Exp 11 is given below:

tinkerlinkExp11

Component list of Exp 11
Component list of Exp 11

Code:

void setup()

{

pinMode(A0,INPUT) ;

Serial.begin(9600);

}

void loop()

{

int lightread = analogRead(A0);

Serial.println(lightread);

delay(5);

}

Explanation:

Setup part:

pinmode()= used to call the photoresistor connected to the analog pin A0 as an INPUT pin , to give input value of resistance from the photoresistor in digital format ; i.e. to get resistance reading of photoresistor as an INPUT.

Serial.begin(): Used to start the serial monitor to print resistance values on changing light intensity.

Loop part:

int lightread = analogRead(A0); = reads the analog resistance readings of the photoresistor connected to analog pin A0 & converts it into digital format(49–969 millisecs) & stores it as an integer in variable ‘lightread’.

Serial.println(lightread); =Prints the resistance readings stored in variable “lightread” continuously on the serial monitor. Each value is printed in a new line.

delay(5);= delays the printing of each resistance value by 5 milliseconds ; for the convenience of the simulation & for the proper printing of all resistance values on the serial monitor in Tinkercad.

All this process happens repeatedly ; i.e. in a continuous loop, and different resistance values are printed on the serial monitor proportional to the intensity of light on the photoresistor at that particular instant of time .

{..} : contains loops (i.e. statements that are repeated continuously.

--

--

anoushka srivastava
ReadWriteRead
0 Followers
Writer for

Student...Learner...dreamer...the list goes endless!!!XDD