You are on page 1of 5

Name : Bhalani Krupa K.

Enrollment No. : 20SOECE11004

Roll No. : 2

Class : 7CE-A

Subject : Internet of Things

Experiment No. : 1

20SOECE11004_Krupa Bhalani 1
1. What is Tinkercad?

 Tinkercad is a free-of-charge, online 3D modeling program that runs in a web browser.[1]


Since it became available in 2011 it has become a popular platform for creating models for 3D
printing as well as an entry-level introduction to constructive solid geometry in schools.

 Tinkercad uses a simplified constructive solid geometry method of constructing models. A


design is made up of primitive shapes that are either "solid" or "hole". Combining solids and
holes together, new shapes can be created, which in turn can be assigned the property of solid
or hole.[3] In addition to the standard library of primitive shapes, a user can create custom
shape generators using a built-in JavaScript editor.

2. Write a program to blink and led in Code.

Code:
void setup()
{
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
void loop()
{
// turn the LED on (HIGH is the voltage level)
digitalWrite(13, HIGH);
delay(1000); //Wait for 1000 millisecond(s)
// turn the LED off by making the voltage LOW
digitalWrite(13, LOW);
delay(1000); //Wait for 1000 millisecond(s)
}

Output:

20SOECE11004_Krupa Bhalani 2
3. Write a program to control brightness of the led in.

Code:
int del = 5;
int a = 0;
void setup()
{
pinMode(3, OUTPUT); // LED control pin is 3, a PWM capable pin
}
void loop()
{
for (a = 0 ; a < 256 ; a++)
{
analogWrite(3, a);
delay(del);
}
for (a = 255 ; a >= 0 ; a--)
{
analogWrite(3, a);
delay(del);
}
delay(200);
}

Output:

20SOECE11004_Krupa Bhalani 3
4. Write a program to run motor in Tinkercad.

Code:
// Motor control pins
const int motorPin = 9;
const int enablePin = 10;
void setup()
{
// Initialize motor control pins as outputs
pinMode(motorPin, OUTPUT);
pinMode(enablePin, OUTPUT);
// Set the enablePin high to enable the motor
digitalWrite(enablePin, HIGH);
}
void loop()
{
// Run the motor in one direction
motorOn();
delay(2000); // Run the motor for 2 seconds
// Stop the motor
motorOff();
delay(1000); // Pause for 1 second
// Run the motor in the opposite direction
motorReverse();
delay(2000); // Run the motor in reverse for 2 seconds
// Stop the motor
motorOff();
delay(1000); // Pause for 1 second
}
// Function to turn on the motor
void motorOn()
{
digitalWrite(motorPin, HIGH);
}
// Function to turn off the motor
void motorOff()
{
digitalWrite(motorPin, LOW);
}
// Function to run the motor in the reverse direction
void motorReverse()
{
digitalWrite(motorPin, LOW); // Turn off the motor

20SOECE11004_Krupa Bhalani 4
digitalWrite(enablePin, LOW); // Reverse the motor by changing the direction of
current flow
digitalWrite(motorPin, HIGH); // Turn on the motor in reverse direction
}

Output:

20SOECE11004_Krupa Bhalani 5

You might also like