blob: 164dc5c1e432033710aa2fa79a0af9327b27eba9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# AVR8js
JavaScript implementation of the AVR 8-bit architecture
[](https://travis-ci.org/wokwi/avr8js)
[](https://www.npmjs.com/package/avr8js)
[](https://gitpod.io/#https://github.com/wokwi/avr8js)
## 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`.
### Walkthrough Video Tutorial
A step-by-step video tutorial showing how to build a simple Arduino simulator using AVR8js and React:
[](https://youtu.be/fArqj-USmjA)
### Unofficial examples
* [Minimal Example](https://stackblitz.com/edit/avr8js-minimal?file=main.ts)
* [6 LEDs](https://stackblitz.com/edit/avr8js-6leds?file=index.ts)
* [LED PWM](https://stackblitz.com/edit/avr8js-pwm?file=index.ts)
* [Serial Monitor](https://stackblitz.com/edit/avr8js-serial?file=index.ts)
* [NeoPixel Matrix](https://stackblitz.com/edit/avr8js-ws2812?file=index.ts)
* [Arduino MEGA NeoPixel Matrix](https://stackblitz.com/edit/avr8js-mega-ws2812?file=index.ts)
* [Simon Game](https://stackblitz.com/edit/avr8js-simon-game?file=index.ts) - with pushbuttons and sound
* [XMAS LEDs](https://stackblitz.com/edit/avr8js-xmas-dafna?file=index.ts)
* [Assembly Code](https://stackblitz.com/edit/avr8js-asm?file=index.ts)
## 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:
* [ATtiny85 Simulation](https://avr8js-attiny85.stackblitz.io?file=index.ts)
Check out [issue 67](https://github.com/wokwi/avr8js/issues/67#issuecomment-728121667) and
[issue 73](https://github.com/wokwi/avr8js/issues/73#issuecomment-743740477) 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](CONTRIBUTING.md).
## License
Copyright (C) 2019, 2020 Uri Shaked. The code is released under the terms of the MIT license.
|