npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

avr8js

v0.20.1

Published

Arduino (8-bit AVR) simulator, written in JavaScript and runs in the browser / Node.js

Downloads

704

Readme

AVR8js

This is a JavaScript library that implementats the AVR 8-bit architecture.

It's the heart- but not the whole body- of the Arduino simulator at https://wokwi.com.

Build Status NPM Version License: MIT Types: TypeScript Gitpod ready-to-code

Example Applications Using AVR8js

How to Use This Library

This library only implements the AVR CPU core. You 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.

A rough conceptual diagram:

Pre-Compiled machine code --> AVR8js <--> Glue code <--> external hardware functional simulation <--> simulation state display for the user

You may be interested in exploring the 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.)

Walkthrough Video Tutorial

A step-by-step video tutorial showing how to build a simple Arduino simulator using AVR8js and React:

AVR8JS Walkthrough Video

And a related blog post.

Unofficial examples

These 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.

Note: they are all hosted outside of this repo.

Running the demo project

The demo project allows you to edit Arduino code, compile it, and run it in the simulator. It also simulates 2 LEDs connected to pins 12 and 13 (PB4 and PB5).

To run the demo project, check out this repository, run npm install and then npm start.

Which chips can be simulated?

The library focuses on simulating the ATmega328p, which is the MCU used by the Arduino Uno.

However, the code is built in a modular way, and is highly configurable, making it possible to simulate many chips from the AVR8 family, such as the ATmega2560 and the ATtiny series:

Check out issue 67 and issue 73 for more information.

Running the tests

Run the tests once:

npm test

Run the tests of the files you modified since last commit (watch mode):

npm run test:watch

For more information, please check the Contributing Guide.

License

Copyright (C) 2019-2023 Uri Shaked. The code is released under the terms of the MIT license.