39 lines
1.8 KiB
HTML
39 lines
1.8 KiB
HTML
<!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>
|