GithubHelp home page GithubHelp logo

markmcode / avr8js-falstad Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 5.0 13.08 MB

Project combining Wokwi's AVR8js Arduino simulator and Paul Falstad's CircuitJS1 circuit simulator

License: GNU General Public License v2.0

HTML 2.16% JavaScript 2.63% Java 74.65% PHP 0.07% C++ 0.06% TypeScript 16.56% CSS 3.88%

avr8js-falstad's Introduction

AVR8js-Falstad

Project combining Wokwi's AVR8js Arduino simulator (https://github.com/wokwi/avr8js) and Paul Falstad's CircuitJS1 circuit simulator (https://github.com/pfalstad/circuitjs1).

Running

To run this project, simply clone or download the repo and open /war/index.html in a compatible browser (known to work with Chrome)

Using

  1. Copy and paste an Arduino script into the text editor on the right side of the screen
  2. Click "Run"
  3. Double-click on each Arduino pin to assign it to an AVR8js pin
  4. Create your own circuits by selecting Draw => Arduino Pin and dragging out Arduino pins (Arduino pins must have the "negative" node connected to a ground element)
  5. Ensure that simulation speed is not set to 0!

Building

To build the CircuitJS1 part of the application, follow the instructions at https://github.com/pfalstad/circuitjs1#building-the-web-application Note:You must be using GWT version 2.8.1 and JDK 1.8.0 to build this. The compiler argument -generateJsInteropExports must be passed

To build the avr8js part of the application, read the README in /avr8js and use "npm run-script build:demo". This utilises my edited package.json file to build my edited version of the demo project.

To integrate these two, move the contents of /avr8js/demo/dist to /war/AVR8js and edit the JS file argument on line 99 of /src/com/lushprojects/circuitjs1/client/circuitjs1.java (motorScript.setPropertyString("src", "AVR8js/src.30e1f952.js")) to reflect the new file being used.

License information

AVR8js (available at https://github.com/wokwi/avr8js) is used under the MIT License: https://github.com/wokwi/avr8js/blob/master/LICENSE

CircuitJS1 (available at https://github.com/pfalstad/circuitjs1) is used under the GPL 2.0 License: https://github.com/pfalstad/circuitjs1/blob/master/COPYING.txt

As a derivative work of AVR8js and CircuitJS1, this project is under the GPL 2.0 License.

avr8js-falstad's People

Contributors

markmcode avatar

Stargazers

 avatar Blake DeCarvalho avatar Andrew Shevchuk avatar  avatar RainGather avatar  avatar Noe S. Sanchez avatar Abdul Qabiz avatar khimaros avatar Charles Zhang avatar RTI TECNOLOLGY avatar  avatar  avatar  avatar hltdev8642 avatar JimFyyc avatar Neo avatar Tawfiq Jawhar avatar

Watchers

Andrew Shevchuk avatar  avatar Claudine Allen avatar

avr8js-falstad's Issues

Interrupts

Hi Mark. Do you think it would be difficult to implement interruptions?
For example , RISING, FALLING OR LOW.
Thanks

Add ground to ArduinoPinElm

Currently, the user must manually add a ground element to the negative side of each Arduino pin element. It should be possible to add an internal ground to this element.

##To-do

  • Edit /src/com/lushprojects/circuitjs1/client/ArduinoPinElm.java to have a single node and internal ground. Look at how input pins are given an internal resistor for reference

Text-blocking

Currently, CircuitJS blocks text from being entered into the AVR8js simulation unless it is pasted in. Text-blocking elements (most likely located in AVR8js-Falstad/src/com/lushprojects/circuitjs1/client/CirSim.java) should be removed.

Undo causes "Matrix error"

If a user starts the AVR8js simulation, edits the circuit and then hits ctrl+z to undo an action, this causes a matrix error. This is most likely caused by either a stamp or dump function within ArduinoPinElm.

Saving pin values

When a circuit is saved, the position of Arduino pin elements is saved but their port and pin values are not. For example, if you create a circuit file, place an Arduino pin, set it to pin D5, save the file and load that file, the pin's number will revert back to B0. This is most likely related to AVR8js-Falstad/src/com/lushprojects/circuitjs1/client/ArduinoPinElm.java's dump() return or constructors.

Integrate Wokwi's compiler/Monaco editor

The current method of copying/pasting hex code is a debug tool, however, it is very inconvenient for general use. As web dependencies won't be an issue for this stand-alone project, re-implementing Wokwi's Arduino compiler and the Monaco editor would be very beneficial.

To-do

  • Edit index.html to use Monaco editor
  • Edit index.ts to use Wokwi's compiler

Potential difficulties:

  • CircuitJS1 may block typing. A solution for this will most likely involve src/com/lushprojects/circuitjs1/client/CirSim.java

Add 1-element limit for analog input pins (port C pins)

If the user creates several elements for the same analog input pin, these pins will attempt to write their voltage values to the same location, causing a conflict. To prevent this, a 1-element limit should be placed on each analog input pin. Perhaps whenever a pin element is set to a pin on port C, it should check to see if there is another element representing that pin. If we do this, it may be convenient to have an array of port C pin flags in which a flag is set if the corresponding pin exists in the circuit simulation. If a port C pin already exists in a simulation, any further identical pin elements should not write to the voltage array.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.