generated from virtual-labs/ph3-exp-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from virtual-labs/main
first commit
- Loading branch information
Showing
25 changed files
with
2,337 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.