Skip to content

Commit

Permalink
Merge pull request #1 from virtual-labs/main
Browse files Browse the repository at this point in the history
first commit
  • Loading branch information
Amarjeetschauhan authored Nov 15, 2023
2 parents 9a10a9c + 6ee8600 commit 04c9df2
Show file tree
Hide file tree
Showing 25 changed files with 2,337 additions and 15 deletions.
140 changes: 140 additions & 0 deletions experiment/simulation/Simulation 1/ledsim.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Virtual IoT Lab DEI</title>
<link rel="icon" href="https://www.vlab.co.in/images/logo.jpg" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="src/css/style.css" />
<style></style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>

<script>
$(document).ready(function () {
$("#master").click(function () {
$("#Code-slave").hide();
$("#arduinoCode").show();
});
});
$(document).ready(function () {
$("#slave").click(function () {
$("#Code-slave").show();
});
});
</script>
<header>
<div class="exp-changer">
<div class="exp-changer-heading">
<p class="p-head">IOT Virtual Lab</p>
</div>
</div>
</header>

<div class="navbar">
<div class="navbar1">
<a href="../../index.html">Home</a>
</div>
<div class="timerDisplay" id="simTimer">Simulation Window</div>
<div class="navbar2">
<a href="../index.html">Go Back</a>
</div>
</div>

<div class="container">
<div class="if-vid">
<p class="p-head">Simulation of establishing master slave model using Arduino and I2C Protocols :</p>
<div class="interfacing">
<img id="ifimg" src="./src/images/led/led_dis.png" alt="interfacing" />
<button id="pushbutton" onclick="changeImage();"></button>
<button id="pushbutton2" onclick="changeLedColor();"></button>
</div>
</div>



<div class="separator"></div>
<div class="code">
<div class="code-head">
<p class="p-head">ARDUINO CODE</p>
</div>
<div class="dropdown">
<button class="dropbtn">Code</button>
<div class="dropdown-content">

<a id="master">Master</a>
<a id="slave">Slave</a>

</div>
</div>

<div class="text-container">
<textarea id="arduinoCode" readonly>
//Code for Master Arduino

#include <Wire.h>
int pushButton = A0;
int x = 0;
void setup()
{
Wire.begin();
pinMode(pushButton, INPUT);
}
void loop()
{
Wire.beginTransmission(1);
x = digitalRead(pushButton);
Wire.write(x);
Wire.endTransmission();
delay(500);
}
</textarea>
<!-- code for slave -->
<textarea id="Code-slave" readonly>
//Code for Slave Arduino

#include <Wire.h>
int pinLed=13;
int x =0;
void setup()
{
Wire.begin(1);
Wire.onReceive(receiveEvent);
pinMode(pinLed, OUTPUT);
}
void loop()
{
delay(100);
}
void receiveEvent(int howMany)
{
x = Wire.read();
if (x == 0)
{
digitalWrite(pinLed,HIGH);
}
else
{
digitalWrite(pinLed,LOW);
}
}
</textarea>
</div>



<div class="code-head startStop">
<h2 id="pushbuttonPower" onclick="changePower();">
Start Simulation
</h2>

</div>

</div>

</div>
</div>
<script type="text/javascript" src="src/js/main.js"></script>
</body>
</html>
Loading

0 comments on commit 04c9df2

Please sign in to comment.