0% found this document useful (0 votes)
2 views

Laboratory # 3_ Analog Input

The document outlines Laboratory #3 for a BSIT-3E program, focusing on creating and simulating an Arduino application using Tinkercad. It includes objectives related to analog input devices and provides sample code for reading sensor values and controlling an LED. Additionally, it specifies laboratory output requirements, including code and a screenshot of the circuit setup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Laboratory # 3_ Analog Input

The document outlines Laboratory #3 for a BSIT-3E program, focusing on creating and simulating an Arduino application using Tinkercad. It includes objectives related to analog input devices and provides sample code for reading sensor values and controlling an LED. Additionally, it specifies laboratory output requirements, including code and a screenshot of the circuit setup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Laboratory # 3: Analog Input

Name: Darrell Kim B. Garcia


Program: BSIT-3E
Instructor: Prof. Mark Philip Felipe

Objective: To create and simulate a simple Arduino application using Tinker cad simulation.
To be able to apply the principle of Input of Analog Device.
To be able to understand the concept of real-life application of programming.

Sample Code

This example code is in the public domain.


http://www.arduino.cc/en/Tutorial/AnalogInput
*/

int sensorValue = 0;

void setup()
{
pinMode(A0, INPUT);
pinMode(11, OUTPUT);
}

void loop()
{
// read the value from the sensor
sensorValue = analogRead(A0);
// turn the LED on
digitalWrite(12, HIGH);
// stop the program for the <sensorValue>
// milliseconds
delay(sensorValue); // Wait for sensorValue millisecond(s)
// turn the LED off
digitalWrite(12, LOW);
// stop the program for the <sensorValue>
// milliseconds
delay(sensorValue); // Wait for sensorValue millisecond(s)
}
Sample Layout

Laboratory Output Requirements.

Code
int sensorValue = 0; // Variable to store the value from the sensor

void setup()
{
pinMode(A0, INPUT); // Set A0 as input for the potentiometer
pinMode(11, OUTPUT); // Set pin 11 as output for the LED
}

void loop()
{
// Read the value from the sensor
sensorValue = analogRead(A0);

// Turn the LED on


digitalWrite(11, HIGH);

// Stop the program for the duration of sensorValue milliseconds


delay(sensorValue);

// Turn the LED off


digitalWrite(11, LOW);
// Stop the program for the duration of sensorValue milliseconds
delay(sensorValue);
}

Screenshot
Code, Circuit (Including Time and Date of the Desktop)

You might also like