Created
April 22, 2013 15:40
-
-
Save sfentress/5436112 to your computer and use it in GitHub Desktop.
Example of a script-authored SPARKS circuit
This file contains hidden or 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
| <html> | |
| <head> | |
| document.onload = function() { | |
| iframe = document.getElementById('iframe'); | |
| activity = { | |
| "_id": "activity", | |
| "show_oscilloscope": "true", | |
| "showComponentDrawer": "true", | |
| "circuit": [ | |
| { | |
| "type": "function generator", | |
| "UID": "source", | |
| "frequencies": [ | |
| "logarithmic", | |
| 100, | |
| 100000, | |
| 1001 | |
| ], | |
| "amplitude": 10 | |
| }, | |
| { | |
| "type": "resistor", | |
| "draggable": true, | |
| "UID": "R1", | |
| "connections": "c5,c11", | |
| "label": "L1" | |
| }, | |
| { | |
| "type": "resistor", | |
| "draggable": true, | |
| "UID": "R2", | |
| "connections": "b11,b17", | |
| "label": "C1" | |
| }, | |
| { | |
| "type": "resistor", | |
| "draggable": true, | |
| "UID": "R3", | |
| "connections": "c17,c23", | |
| "label": "L1" | |
| }, | |
| { | |
| "type": "wire", | |
| "draggable": true, | |
| "connections": "left_positive20,a23" | |
| }, | |
| { | |
| "type": "wire", | |
| "draggable": true, | |
| "connections": "left_negative8,a5" | |
| } | |
| ] | |
| } | |
| iframe.contentWindow.postMessage(JSON.stringify(activity), '*'); | |
| } | |
| </head> | |
| <body> | |
| <h1>Example embedded SPARKS circuit</h1> | |
| <iframe src="http://sparks.portal.concord.org/sparks-content/embeddable.html#rlc-draggable" width="800px" height="500px"></iframe> | |
| <p>Check out this cool circuit from <a href="http://sparks.concord.org">http://sparks.concord.org</a>!</p> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment