MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/sb_web/b1536/advancedfunctions.co/aip/
File Upload :
Current < : /hermes/sb_web/b1536/advancedfunctions.co/aip/trafficLight.js

var videoFilesCodeBig="";
var videoFilesCodeSmall="";
var alternate=0;
var menuText='';

function display(mode){
var menuItem1='';
var menuComponent1='';
var menuItem2='';
var menuComponent2='';
var menuItem3='';
var menuComponent3='';

if(mode==0){
resetPage();
menuItem1="What is a microcontroller?";
menuComponent1="A <u>microcontroller</u> is small version of a <u>computer</u>.  A <u>computer</u> takes input, does some math with it, and outputs the result.<br><br>The input is sent to the <u>computer</u> in our laptops/desktops by keyboards and touch pads for example, and the <u>computer</u> outputs data to monitors to show pictures or to speakers to make sound.  <b>A laptop’s motherboard and a microcontroller do the same thing!</b>";
menuItem2="What can a microcontroller do?";
menuComponent2="Microcontroller like the one we will program are used in washing machines, car radios, microwaves etc.  Let’s take a look at the video to see the amazing projects people have made with microcontrollers.";
menuItem3="Sign up for Tinkercad";
menuComponent3="If you are already signed up for Tinkercad, skip the next step.<br>Go to https://www.tinkercad.com/ to sign up for Tinkercad.";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addYoutubeVideoFile("<iframe src='https://www.youtube.com/embed/QUQta4f_87E' frameborder='0' height='100%' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>",'Introduction to Arduino',menuText);

menuItem1="What is a LED?";
menuComponent1="When current flows through a LED, it lights.  The LED has two legs: a short leg called the cathode, which is negative, and longer leg called the anode, which is positive (+).  <br><br>In order for a LED to light, a power supply, a component called a resistor and the LED must be connected in <i>series</i>.  A series connection looks like three people holding hands in a circle.  One person represents the power supply, the other - the resistor and the third the LED.  If the LED is connected backwards it will not light.  So the plus of the LED must lead back to the plus of the power supply and the minus of the LED must lead back to the minus of the power supply.  ";
menuItem2="What is a resistor?";
menuComponent2="If too much current flows through a LED, it blows and if too little, it does not light.  A carefully selected resistor ensures just enough current flows through the LED.  A resistor also has two legs but the legs do not have polarity i.e. they are neither + nor -.";
menuItem3='Light a virtual LED using Tinkercad';
menuComponent3='Follow the instruction video to make a virtual LED light.  You may right click on the video to change the speed to 0.5x, which is half as fast.';
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1fhwNwhsT89RDXuACUfm_-kMAB3k49ibv",'Lighting a LED',menuText);

menuItem1="How to properly wire a breadboard";
menuComponent1="1. A green marker will highlight all holes that are connected.<br><br>2. Never put two pins in the same hole.";
menuItem2="Light a LED on a breadboard";
menuComponent2="Follow the instruction video to light a LED on a breadboard.<br><h3> Challenge</h3>1. Place a second LED anywhere on the board.<br>2. Place a third LED on the board, BUT connect the LED to the resistor directly - there should only be two wires used.<br>3. Place a fourth LED on the board, that is powered by the other pair of power rails.";
menuItem3='Assemble the circuit using your kit';
menuComponent3='Once the instructor has checked your circuit, plug the USB cable into the microcontroller and the other end into your computer. ';
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1BAm49XS0JDyDswzyN5YGGEgkvHIPUS3p","Using a breadboard",menuText);

menuItem1="What are digital pins?";
menuComponent1="A digital pin will send 5V if it is set to HIGH, and 0V if it is set to LOW. ";
menuItem2="What is meant by programming?";
menuComponent2="Programming is writing a list of instructions for a computer to follow.  The computer follows, or <i>executes</i> one line of code after another.  A computer NEVER executes more than one lines at the same time.";
menuItem3="What is a while loop?";
menuComponent3="A while loop is a function that repeats the code inside of it.  <br>A while loop is made with a condition. <br>It continues to repeat until its condition is false.  This is why we set 1=1 as the condition.  1=1 is a true statement.  <br>Change 1=1 to 1=2 and check if the loop executes.";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1DMfXmk3rouV3IfukPsPI6wMw6z8-TDd1","Blinking a LED",menuText);

menuItem1="Blinking a LED on the Arduino";
menuComponent1="Keep the Blinking a LED Tinkercad project open for later.";
menuItem2="Download and install Arduino";
menuComponent2="If Arduino is already installed, skip the next step.<br>Go to https://www.arduino.cc/en/software to download the Arduino IDE for your computer. Do not download the Experimental Software";
menuItem3="Upload code to microprocessor";
menuComponent3="Follow the on screen instructions to burn your code onto the microprocessor chip. ";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1xs3eB2Yol8hAoC1NsqqKhoB1pSvIcaR1","Programming Arduino",menuText);

menuItem1="Blink two LEDs in Tinkercad";
menuComponent1="Follow the instructions in the video to blink two LEDs.  ";
menuItem2="Challenge - make a siren";
menuComponent2="Modify your code so the LEDs take turns flashing like a the siren of a police car.";
menuItem3="Assemble the circuit with your kit";
menuComponent3="Make sure the instructor looks at your circuit before you plug in it into your computer.  Transfer your Tinkercad code to Arduino Sketch and upload to microprocessor.  ";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=160U9ktuWCPXhuTB13gQiO7enh0GnWIHc","Blinking two LEDs",menuText);

menuItem1="Build a traffic light in Tinkercad";
menuComponent1="Make a traffic light in Tinkercad the follows the same sequence as in the animation.  ";
menuItem2="Challenge";
menuComponent2="Make a pair of traffic lights that would be found at a junction.  When one traffic light is red, the other should be green.";
menuItem3="Assemble the circuit with your kit";
menuComponent3="Make sure the instructor looks at your circuit before you plug in it into your computer.  Transfer your Tinkercad code to Arduino Sketch and upload to microprocessor.  ";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1xrkWp-YzyphCYEl1I-_xPnATDt3yWiRB","Traffic Lights",menuText);

menuItem1="Drawing 2D in Onshape";
menuComponent1="Follow the instructions in the video to draw the outline of the main parts of the traffic light.";
menuItem2="";
menuComponent2="";
menuItem3="";
menuComponent3="";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1Z_JZmwNjtE6AzaQJIcHOUuKfBEZZHawt","Traffic Light Modelling Pt.1",menuText);

menuItem1="3D operations";
menuComponent1="If you pushed soft clay through a circular cutout you get a cylinder.  If you push it through a square cutout you get a cuboid.  This is what is meant by <i>extrusion</i>.<br><br><i>Boolean</i> operations are used to make 3D shapes in Onshape.  Boolean operations include adding and subtracting basic solid shapes.  Building a snow man is an example of using boolean operations - you <i>add</i> a smaller sphere on top of a larger sphere, and then add an even smaller sphere on top of that one.";
menuItem2="Drawing 3D in Onshape";
menuComponent2="Follow the instructions in the video to convert the outline into a solid shape. ";
menuItem3="";
menuComponent3="";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1zULz7n55JSSAxNAFd9U_nsfudn-V6xpd","Traffic Light Modelling Pt.2",menuText);

menuItem1="Inkscape";
menuComponent1="Download Inkscape at https://inkscape.org/release/1.0.2/platforms/<br><br>Inkscape is used to make <i>vector files</i> for use by a laser cutter.  Vector files never become blurry now matter how much they are enlarged.";
menuItem2="Net Diagrams";
menuComponent2="Follow the instructions in the video to make a <i>net diagram</i> for the traffic light.  A net diagram shows all the faces of a solid shape and may be cut out and folded to make the shape.";
menuItem3="";
menuComponent3="";
populateNavigator(menuItem1,menuComponent1,menuItem2,menuComponent2,menuItem3,menuComponent3);
addVideoFile("https://drive.google.com/uc?export=view&id=1C8UXZhDGlBh26yKbOFk6hh4tk_r9D8rX","Traffic Light Net Diagram",menuText);

}
if(mode==1){
resetPage();
addVideoFile('pumpAssembly.mp4','Pump Assembly','test');
}
}

function resetPage(){
videoFilesCodeBig='';
videoFilesCodeSmall='';}

function addVideoFile(videoFile,title,text){
if(alternate%2==0){
videoFilesCodeBig=videoFilesCodeBig+"<div class='w3-animate-zoom'  style='display:grid; grid-template-columns: auto 50%;padding:10vw' ><div style='box-shadow: 4px 4px 16px 0 rgba(0, 0, 0, 0.5); display: flex; align-items:center; background-color:black;'><video width='100%' controls><source src='"+videoFile+"' type='video/mp4' type='video/ogg; codecs=theora,vorbis' type='video/webm; codes=vp8,vorbis'></video></div><div><div style='font-family: &#39;Anton&#39;, sans-serif;font-size:6vh;text-align:right; '>"+title+"</div><div style='text-align:justify;padding-left:60px; '>"+text+"</div></div></div>";

}else{
videoFilesCodeBig=videoFilesCodeBig+"<div class='w3-animate-zoom' style='display:grid; grid-template-columns: auto 50%;padding:10vw;' ><div><div style='font-family: &#39;Anton&#39;, sans-serif;font-size:6vh;'>"+title+"</div><div style='text-align:justify;padding-right:60px;'>"+text+"</div></div><div style='box-shadow: 4px 4px 16px 0 rgba(0, 0, 0, 0.5);display: flex; align-items:center;background-color:black;'><video width='100%' controls><source src='"+videoFile+"' type='video/mp4' type='video/ogg; codecs=theora,vorbis' type='video/webm; codes=vp8,vorbis'></video></div></div>";

}

videoFilesCodeSmall=videoFilesCodeSmall+"<div class='w3-animate-zoom' style='margin-top:80px;' ><div><div style='font-family: &#39;Anton&#39;, sans-serif;font-size:4vh;text-align:right;padding:10px;'>"+title+"</div><div style='text-align:justify;'>"+text+"</div></div><div style='box-shadow: 4px 4px 16px 0 rgba(0, 0, 0, 0.5);display: flex; align-items:center;background-color:black;margin-top:20px;'><video width='100%' controls ><source src='"+videoFile+"' type='video/mp4' type='video/ogg; codecs=theora,vorbis' type='video/webm; codes=vp8,vorbis' ></video></div><hr></div>";

alternate++;
document.getElementById("videoFilesBig").innerHTML="<div style='width: 80%;margin:auto;'>"+videoFilesCodeBig+"</div>";
document.getElementById("videoFilesSmall").innerHTML="<div style='width: 95%;margin:auto;'>"+videoFilesCodeSmall+"</div>";

}

function addYoutubeVideoFile(videoFile,title,text){
if(alternate%2==0){
videoFilesCodeBig=videoFilesCodeBig+"<div class='w3-animate-zoom'  style='display:grid; grid-template-columns: auto 50%;padding:10vw;' ><div style='box-shadow: 4px 4px 16px 0 rgba(0, 0, 0, 0.5);'><div style='text-align:center;background-color:black;height:100%' >"+videoFile+"</div></div><div><div style='font-family: &#39;Anton&#39;, sans-serif;font-size:6vh;text-align:right; '>"+title+"</div><div style='text-align:justify;padding-left:60px; '>"+text+"</div></div></div>";
}else{
videoFilesCodeBig=videoFilesCodeBig+"<div class='w3-animate-zoom' style='display:grid; grid-template-columns: auto 50%;padding:10vw;' ><div><div style='font-family: &#39;Anton&#39;, sans-serif;font-size:6vh;'>"+title+"</div><div style='text-align:justify;padding-right:60px;'>"+text+"</div></div><div style='box-shadow: 4px 4px 16px 0 rgba(0, 0, 0, 0.5);'><div style='text-align:center;background-color:black;height:100%;'>"+videoFile+"</div> </div></div>";
}
videoFilesCodeSmall=videoFilesCodeSmall+"<div class='w3-animate-zoom'  style='margin-top:80px;' ><div><div style='font-family: &#39;Anton&#39;, sans-serif;font-size:4vh;text-align:right;'>"+title+"</div><div style='text-align:justify;padding:10px;margin-bottom:20px;'>"+text+"</div></div><div style='box-shadow: 4px 4px 16px 0 rgba(0, 0, 0, 0.5);'><div style='text-align:center;height:100%;'>"+videoFile+"</div> </div><hr></div>";

alternate++;
document.getElementById("videoFilesBig").innerHTML="<div style='width: 80%;margin:auto;'>"+videoFilesCodeBig+"</div>";
document.getElementById("videoFilesSmall").innerHTML="<div style='width: 95%;margin:auto;'>"+videoFilesCodeSmall+"</div>";
}

function exitDialogs(){
document.getElementById("functionsDialogWithTextBig").style.display = "none"; 
document.getElementById("functionsDialogWithTextSmall").style.display = "none"; 
}
function showText(textToDisplay,title){
document.getElementById("functionsDialogTextBig").innerHTML="<h2><i class='fas fa-book-reader'></i>&nbsp; <u>"+title+"</h2></u><br>"+textToDisplay+"<br>&nbsp;";
document.getElementById("functionsDialogTextSmall").innerHTML="<h3><i class='fas fa-book-reader'></i>&nbsp; <u>"+title+"</h3></u><br>"+textToDisplay+"<br>&nbsp;";

document.getElementById("functionsDialogWithTextBig").style.display = "block"; 
document.getElementById("functionsDialogTextBig").style.display = "block"; 
document.getElementById("functionsDialogWithTextSmall").style.display = "block"; 
document.getElementById("functionsDialogTextSmall").style.display = "block"; 

}

function populateNavigator(menuItem1,menuContent1,menuItem2,menuContent2,menuItem3,menuContent3){
menuText="<nav class=' w3-bar-block w3-collapse w3-large w3-theme-l5 w3-animate-left' id='mySidebar' ><h4 class='w3-bar-item' ><b>Menu</b></h4><a class='w3-bar-item w3-button w3-hover-black' href='javascript:showText(&#39;"+menuContent1+"&#39;,&#39;"+menuItem1+"&#39;)'><i class='fas fa-book-reader'></i> "+menuItem1+"</a><a class='w3-bar-item w3-button w3-hover-black' href='javascript:showText(&#39;"+menuContent2+"&#39;,&#39;"+menuItem2+"&#39;)'><i class='fas fa-book-reader'></i> "+menuItem2+"</a><a class='w3-bar-item w3-button w3-hover-black' href='javascript:showText(&#39;"+menuContent3+"&#39;,&#39;"+menuItem3+"&#39;)'><i class='fas fa-book-reader'></i> "+menuItem3+"</a></nav>";

if(menuItem3==''){
menuText="<nav class=' w3-bar-block w3-collapse w3-large w3-theme-l5 w3-animate-left' id='mySidebar' ><h4 class='w3-bar-item' ><b>Menu</b></h4><a class='w3-bar-item w3-button w3-hover-black' href='javascript:showText(&#39;"+menuContent1+"&#39;,&#39;"+menuItem1+"&#39;)'><i class='fas fa-book-reader'></i> "+menuItem1+"</a><a class='w3-bar-item w3-button w3-hover-black' href='javascript:showText(&#39;"+menuContent2+"&#39;,&#39;"+menuItem2+"&#39;)'><i class='fas fa-book-reader'></i> "+menuItem2+"</a></nav>";
}

if(menuItem2==''&&menuItem3==''){
menuText="<nav class=' w3-bar-block w3-collapse w3-large w3-theme-l5 w3-animate-left' id='mySidebar' ><h4 class='w3-bar-item' ><b>Menu</b></h4><a class='w3-bar-item w3-button w3-hover-black' href='javascript:showText(&#39;"+menuContent1+"&#39;,&#39;"+menuItem1+"&#39;)'><i class='fas fa-book-reader'></i> "+menuItem1+"</a></nav>";
}

}