{"id":15293226,"url":"https://github.com/wokwi/avr8js","last_synced_at":"2025-05-14T22:07:34.684Z","repository":{"id":36298268,"uuid":"222682502","full_name":"wokwi/avr8js","owner":"wokwi","description":"Arduino (8-bit AVR) simulator, written in JavaScript and runs in the browser / Node.js","archived":false,"fork":false,"pushed_at":"2025-02-11T09:01:59.000Z","size":3126,"stargazers_count":525,"open_issues_count":14,"forks_count":80,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-21T08:10:14.222Z","etag":null,"topics":["arduino","atmega","atmega328p","avr","javascript","microcontroller","simulation","typescript"],"latest_commit_sha":null,"homepage":"https://blog.wokwi.com/avr8js-simulate-arduino-in-javascript/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wokwi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-19T11:40:52.000Z","updated_at":"2025-04-17T02:01:56.000Z","dependencies_parsed_at":"2024-06-18T18:41:05.439Z","dependency_job_id":"a3d4576f-1198-410f-8ade-b611a0e37fd1","html_url":"https://github.com/wokwi/avr8js","commit_stats":{"total_commits":304,"total_committers":6,"mean_commits":"50.666666666666664","dds":0.08552631578947367,"last_synced_commit":"6ecba64687e10113ad697860b5f103746a8ef329"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wokwi%2Favr8js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wokwi%2Favr8js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wokwi%2Favr8js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wokwi%2Favr8js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wokwi","download_url":"https://codeload.github.com/wokwi/avr8js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235696,"owners_count":22036963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","atmega","atmega328p","avr","javascript","microcontroller","simulation","typescript"],"created_at":"2024-09-30T16:45:07.552Z","updated_at":"2025-05-14T22:07:29.670Z","avatar_url":"https://github.com/wokwi.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# AVR8js\n\nThis is a JavaScript library that implementats the AVR 8-bit architecture.\n\nIt's the heart- but not the whole body- of the Arduino simulator at [https://wokwi.com](https://wokwi.com).\n\n[![Build Status](../../workflows/ci/badge.svg)](https://github.com/wokwi/avr8js/actions/workflows/ci.yml)\n[![NPM Version](https://img.shields.io/npm/v/avr8js)](https://www.npmjs.com/package/avr8js)\n![License: MIT](https://img.shields.io/npm/l/avr8js)\n![Types: TypeScript](https://img.shields.io/npm/types/avr8js)\n[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/wokwi/avr8js)\n\n## Example Applications Using `AVR8js`\n\n* [Wokwi Arduino Simulator](https://wokwi.com) - Arduino simulator with a choice of hardware that can be wired up dynamically in your browser!\n* [avr8js-electron playground](https://github.com/arcostasi/avr8js-electron-playground) - a Downloadable Electron Arduino simulator app\n* [AVR8js-Falstad](https://markmegarry.github.io/AVR8js-Falstad/) - combining the Falstad circuit simulator with AVR8js!\n* [The Engineering Physics Department of Dawson College's Arduino Course](https://tawjaw.github.io/Arduino-Robot-Virtual-Lab/) - an introduction to Arduino with a focus on robotics\n\n## How to Use This Library\n\nThis library only implements the AVR CPU core. \nYou have to supply it pre-compiled machine code to run, and implement functional simulations of any external hardware. You will probably also want to add  audio/visual representations of external hardware being simulated.\n\nA rough conceptual diagram:\n\n```\nPre-Compiled machine code --\u003e AVR8js \u003c--\u003e Glue code \u003c--\u003e external hardware functional simulation \u003c--\u003e simulation state display for the user\n```\nYou may be interested in exploring the [wokwi-elements](https://github.com/wokwi/wokwi-elements) collection of web-components for visual representations of many common hardware components. (Note: these are visual only elements- you will need to add the appropriate functional simulation and glue code.)\n\n### Walkthrough Video Tutorial\n\nA step-by-step video tutorial showing how to build a simple Arduino simulator using AVR8js and React:\n\n[![AVR8JS Walkthrough Video](https://i.imgur.com/3meSd1m.png)](https://youtu.be/fArqj-USmjA)\n\nAnd a related [blog post](https://blog.wokwi.com/avr8js-simulate-arduino-in-javascript/).\n\n### Unofficial examples\n\nThese examples show working examples of using `avr8js` in an application. Many of them also demonstrate how to use the `wokwi-elements` and include working examples of functional simulations of the components, and how to hook them up to `avr8js`.\n\n* [Minimal Example](https://stackblitz.com/edit/avr8js-minimal?file=main.ts)\n* [6 LEDs](https://stackblitz.com/edit/avr8js-6leds?file=index.ts)\n* [LED PWM](https://stackblitz.com/edit/avr8js-pwm?file=index.ts)\n* [Serial Monitor](https://stackblitz.com/edit/avr8js-serial?file=index.ts)\n* [NeoPixel Matrix](https://stackblitz.com/edit/avr8js-ws2812?file=index.ts)\n* [Arduino MEGA NeoPixel Matrix](https://stackblitz.com/edit/avr8js-mega-ws2812?file=index.ts)\n* [Simon Game](https://stackblitz.com/edit/avr8js-simon-game?file=index.ts) - with pushbuttons and sound\n* [XMAS LEDs](https://stackblitz.com/edit/avr8js-xmas-dafna?file=index.ts)\n* [Assembly Code](https://stackblitz.com/edit/avr8js-asm?file=index.ts)\n* [EEPROM persistence](https://stackblitz.com/edit/avr8js-eeprom-localstorage?file=eeprom-localstorage-backend.ts)\n\nNote: they are all hosted outside of this repo.\n\n## Running the demo project\n\nThe demo project allows you to edit Arduino code, compile it, and run it in the simulator.\nIt also simulates 2 LEDs connected to pins 12 and 13 (PB4 and PB5). \n\nTo run the demo project, check out this repository, run `npm install` and then `npm start`.\n\n## Which chips can be simulated?\n\nThe library focuses on simulating the *ATmega328p*, which is the MCU used by the Arduino Uno.\n\nHowever, the code is built in a modular way, and is highly configurable, making it possible\nto simulate many chips from the AVR8 family, such as the ATmega2560 and the ATtiny series:\n\n* [ATtiny85 Simulation](https://avr8js-attiny85.stackblitz.io?file=index.ts)\n\nCheck out [issue 67](https://github.com/wokwi/avr8js/issues/67#issuecomment-728121667) and\n[issue 73](https://github.com/wokwi/avr8js/issues/73#issuecomment-743740477) for more information.\n\n## Running the tests\n\nRun the tests once:\n\n```\nnpm test\n```\n\nRun the tests of the files you modified since last commit (watch mode):\n\n```\nnpm run test:watch\n```\n\nFor more information, please check the [Contributing Guide](CONTRIBUTING.md).\n\n## License\n\nCopyright (C) 2019-2025 Uri Shaked. The code is released under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwokwi%2Favr8js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwokwi%2Favr8js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwokwi%2Favr8js/lists"}