Comments (5)
Hi, the websocket interface was contributed by someone so I know little about it, other than what you can read here: https://github.com/pfalstad/circuitjs1/tree/master/websocket
You can load circuits and set voltage sources so that might be enough. I'm not sure what MCU information you need to pass to the simulator.
from circuitjs1.
I need to be able to tell the simulator when there is a voltage coming out of a GPIO from the MCU to activate a circuit int the simulator. I also need to be able to collect voltages from a circuit connected to a GPIO in a circuit.
I would need to be able to add an MCU to the simulator as well where the GPIOs would be defined so a person could draw out the circuits and connect them to the GPIOs
from circuitjs1.
I might be pointing out obvious things here... If so, please feel free to tell me and I'm sorry in advance ;)
There is a version with an AVR8 simulator. I think this is doing what pfalstad described above, i.e. run the MCU simulator in parallel to circuitjs and update "external voltage sources" in the circuit, which represent the MCU pins. This approach should work with any MCU, as long as you only need one of them at a time. The upside is that you can easily have dedicated UI for the MCU, i.e. a code editor.
The other option would be to make a custom circuit element, e.g. based on ChipElm
, as described in INTERNALS.md.
(I'm looking through the existing issues because I'm interested in making a custom circuit element that can be programmed in Javascript. If I get this into a usable state, this might be another option - but I think the existing options are better for your case.)
from circuitjs1.
This gives you some idea of what I am working with.
https://www.youtube.com/watch?v=j9NI1cFOKrE
All bundled together, code editor, display to simulate graphics output from LVGL, the last missing piece is the circuit simulator with the ability to add pins and tell the circuit simulator what the voltage is if there is output from a pin, or reading voltage from the circuit simulator for a specific pin.
What you see in that video is aa port of Python called MicroPython. It is able to be compiled and run as Javascript. This specific port has been compiled with a GUI framework, hence why you see the animated graphic in the upper right. The code editor is right there and a simple click of the button runs any code in the editor instantly. If there was the circuit simulator it would be a really nice way to develop for an MCU.
MicroPython is able to be compiled for a bunch of different MCUs and also things that are not an MCU as well. It can also be compiled to run on Windows, Linux and also Javascript. LVGL which is the graphics library can run on just about any kind if a device so long as it meets these minimum specs:
16bit processor
16MHz
64kB of program storage
8kB of RAM
and is compiled using C99 or newer.
I just wrote a binding to LVGL for CPython. You can use any thing that has the ability to draw a frame buffer to the screen. There are 2 examples with it using SDL2 and wxPython. The binding is still in the early stages of development but it is mostly functional. That binding will make it possible for people to use the IDE/simulator to develop for a Raspberry Pi which can run CPython
The link that @BBBSnowball posted is along the same lines. Add the display support and remove the need to compile the script server side. MicroPython scripts are just like normal Python scripts they are compiled at runtime. because MicroPython is running using JavaScript on the local machine that runtime compilation of the script gets done on the local machine. The script doesn't even get sent to the server to run it.
from circuitjs1.
I also did want to mention that the display portion is fully interactive and accepts user input.
from circuitjs1.
Related Issues (20)
- Reset button does not really reset circuit HOT 1
- Supress "Can't load circuit list!"
- Decoupling capacitor causes error message: "Capacitor loop with no resistance!" HOT 2
- Feature- Latching Relays
- Ctrl + 2 fingers click = 2 fingers click = context menu in the way on Mac M1 HOT 2
- Zooming and panning doesn't work on mobile HOT 2
- interrupts on avr8js
- Ignoring timestep and running simulations without UI updates HOT 1
- I've discovered free energy!
- There is no quick undo ! HOT 2
- 555 timer with non-ground negative supply HOT 3
- Apple Silicon (ARM) version ? HOT 4
- How to remove sub circuits from the Draw->Subcircuits menu
- Analog switch: Lack of input voltage settings in the Edit Component dialog
- low frame rate when speed is too high HOT 4
- Annoying unintentional drag of the drawn box or line
- BUG: Potentiometer wiper position change on file open (or on file save?)
- Feature Request: Plot charge in scope (useful for switched capacitors) - example provided
- The relay component switches to the intermediate state immediately giving incorrect results for some circuits.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circuitjs1.