first commit
This commit is contained in:
33
avr8js/analog.html
Normal file
33
avr8js/analog.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>AVR8js CircuitJS1 Demo</title><link href="//fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet"><link rel="stylesheet" href="src.avr8js.css"></head><body> <h2>AVR8js CircuitJS1 Demo</h2> <div style="width:50%;position:fixed;left:0;">
|
||||
|
||||
<iframe id="circuitFrame" width="95%" height="800" src="../circuitjs.html?startCircuit=avr8js-analog.txt&running=false"></iframe>
|
||||
<p> <a href="index.html">LED strobe</a>, <a href="logic.html">Logic</a>, <a href="analog.html">Analog Read</a></p>
|
||||
|
||||
</div> <div style="width:50%;position:fixed;right:0;">
|
||||
<p>Click Run below to start the simulation.</p>
|
||||
<div class="toolbar"> <button id="run-button">Run</button> <button id="stop-button" disabled="">Stop</button> <button id="revert-button">Back to initial example</button> <div class="spacer"></div> <div id="status-label"></div> </div> <div class="code-editor"></div> <div class="compiler-output"> <pre id="compiler-output-text"></pre> <pre id="serial-output-text"></pre> </div> </div> <script src="//cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.2/min/vs/loader.js"></script> <script>
|
||||
|
||||
window.defaultCode=`
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
pinMode(8, OUTPUT);
|
||||
pinMode(9, OUTPUT);
|
||||
pinMode(10, OUTPUT);
|
||||
pinMode(11, OUTPUT);
|
||||
pinMode(12, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// create labeled node with name A0 to access analog pin A0
|
||||
int a = analogRead(0);
|
||||
digitalWrite(8, (a & 512) != 0);
|
||||
digitalWrite(9, (a & 256) != 0);
|
||||
digitalWrite(10, (a & 128) != 0);
|
||||
digitalWrite(11, (a & 64) != 0);
|
||||
digitalWrite(12, (a & 32) != 0);
|
||||
}
|
||||
`;
|
||||
|
||||
</script> <script src="src.avr8js.js"></script> </body></html>
|
||||
|
38
avr8js/index.html
Normal file
38
avr8js/index.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>AVR8js CircuitJS1 Demo</title><link href="//fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet"><link rel="stylesheet" href="src.avr8js.css"></head><body> <h2>AVR8js CircuitJS1 Demo</h2> <div style="width:50%;position:fixed;left:0;">
|
||||
|
||||
<iframe id="circuitFrame" width="95%" height="800" src="../circuitjs.html?startCircuit=avr8js-strobe.txt&running=false"></iframe>
|
||||
<p> <a href="index.html">LED strobe</a>, <a href="logic.html">Logic</a>, <a href="analog.html">Analog Read</a></p>
|
||||
|
||||
</div> <div style="width:50%;position:fixed;right:0;">
|
||||
<p>Click Run below to start the simulation.</p>
|
||||
<div class="toolbar"> <button id="run-button">Run</button> <button id="stop-button" disabled="">Stop</button> <button id="revert-button">Back to initial example</button> <div class="spacer"></div> <div id="status-label"></div> </div> <div class="code-editor"></div> <div class="compiler-output"> <pre id="compiler-output-text"></pre> <pre id="serial-output-text"></pre> </div> </div> <script src="//cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.2/min/vs/loader.js"></script> <script>
|
||||
|
||||
window.defaultCode=`
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// add external voltage (Javascript) with name "pin n" to access output pins
|
||||
pinMode(8, OUTPUT);
|
||||
pinMode(9, OUTPUT);
|
||||
pinMode(10, OUTPUT);
|
||||
pinMode(11, OUTPUT);
|
||||
pinMode(12, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int i;
|
||||
Serial.println("looping");
|
||||
for (i = 8; i != 12; i++) {
|
||||
digitalWrite(i, HIGH);
|
||||
delay(50);
|
||||
digitalWrite(i, LOW);
|
||||
}
|
||||
for (i = 12; i != 8; i--) {
|
||||
digitalWrite(i, HIGH);
|
||||
delay(50);
|
||||
digitalWrite(i, LOW);
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
</script> <script src="src.avr8js.js"></script> </body></html>
|
33
avr8js/logic.html
Normal file
33
avr8js/logic.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>AVR8js CircuitJS1 Demo</title><link href="//fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet"><link rel="stylesheet" href="src.avr8js.css"></head><body> <h2>AVR8js CircuitJS1 Demo</h2> <div style="width:50%;position:fixed;left:0;">
|
||||
|
||||
<iframe id="circuitFrame" width="95%" height="800" src="../circuitjs.html?startCircuit=avr8js-logic.txt&running=false"></iframe>
|
||||
<p> <a href="index.html">LED strobe</a>, <a href="logic.html">Logic</a>, <a href="analog.html">Analog Read</a></p>
|
||||
|
||||
</div> <div style="width:50%;position:fixed;right:0;">
|
||||
<p>Click Run below to start the simulation.</p>
|
||||
<div class="toolbar"> <button id="run-button">Run</button> <button id="stop-button" disabled="">Stop</button> <button id="revert-button">Back to initial example</button> <div class="spacer"></div> <div id="status-label"></div> </div> <div class="code-editor"></div> <div class="compiler-output"> <pre id="compiler-output-text"></pre> <pre id="serial-output-text"></pre> </div> </div> <script src="//cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.2/min/vs/loader.js"></script> <script>
|
||||
|
||||
window.defaultCode=`
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// create labeled node with name "pin n" to access input pins
|
||||
pinMode(8, INPUT);
|
||||
pinMode(9, INPUT);
|
||||
|
||||
// create external voltage (javascript) with name "pin n" to access output pins
|
||||
pinMode(10, OUTPUT);
|
||||
pinMode(11, OUTPUT);
|
||||
pinMode(12, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int a = digitalRead(8);
|
||||
int b = digitalRead(9);
|
||||
digitalWrite(10, a & b);
|
||||
digitalWrite(11, a | b);
|
||||
digitalWrite(12, a ^ b);
|
||||
}
|
||||
`;
|
||||
|
||||
</script> <script src="src.avr8js.js"></script> </body></html>
|
55
avr8js/src.avr8js.css
Normal file
55
avr8js/src.avr8js.css
Normal file
@@ -0,0 +1,55 @@
|
||||
body {
|
||||
padding: 0 16px;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.app-container {
|
||||
width: 700px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
background-color: #ddd;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.toolbar > button {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.code-editor {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
height: 300px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid grey;
|
||||
}
|
||||
|
||||
.compiler-output {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 12px;
|
||||
max-height: 160px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.compiler-output pre {
|
||||
margin: 0;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
#serial-output-text {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
|
||||
/*# sourceMappingURL=/src.77de5100.css.map */
|
1
avr8js/src.avr8js.css.map
Normal file
1
avr8js/src.avr8js.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.css"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"src.77de5100.css","sourceRoot":"../src","sourcesContent":["body {\n padding: 0 16px;\n font-family: 'Roboto', sans-serif;\n width: 100%;\n box-sizing: border-box;\n}\n\n.app-container {\n width: 700px;\n max-width: 100%;\n}\n\n.toolbar {\n padding: 4px;\n display: flex;\n background-color: #ddd;\n box-sizing: border-box;\n width: 100%;\n}\n\n.toolbar > button {\n margin-right: 4px;\n}\n\n.spacer {\n flex: 1;\n}\n\n.code-editor {\n width: 100%;\n max-width: 100%;\n height: 300px;\n box-sizing: border-box;\n border: 1px solid grey;\n}\n\n.compiler-output {\n width: 100%;\n box-sizing: border-box;\n padding: 8px 12px;\n max-height: 160px;\n overflow: auto;\n}\n\n.compiler-output pre {\n margin: 0;\n white-space: pre-line;\n}\n\n#serial-output-text {\n color: blue;\n}\n"]}
|
11640
avr8js/src.avr8js.js
Normal file
11640
avr8js/src.avr8js.js
Normal file
File diff suppressed because it is too large
Load Diff
1
avr8js/src.avr8js.js.map
Normal file
1
avr8js/src.avr8js.js.map
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user