// open-source libs
Wokwi Libraries
Eidolon uses official Wokwi open-source repositories cloned locally in third-party/. This gives you up-to-date, compatible emulation engines and visual components without npm registry dependencies.
Cloned Repositories
| Library | Location | Purpose |
|---|---|---|
| @wokwi/elements | npm | 48+ Lit Web Components (LEDs, LCDs, sensors, buttons...) |
| avr8js | npm | ATmega328p / ATmega2560 CPU emulator at 16 MHz |
| rp2040js | npm | Raspberry Pi Pico (RP2040) emulator |
All three libraries are pulled directly from the npm registry by apps/web/package.json. Reference clones may live under third-party/ for credits and offline hacking, but the build does not require them.
Updating the Libraries
Edit the version pins in apps/web/package.json (@wokwi/elements, avr8js, rp2040js) and run npm install in apps/web/.
After bumping wokwi-elements (only when adding new components)
The metadata generator scans the upstream src/, which the npm package doesn't ship. Clone wokwi-elements once into third-party/ and regenerate:
git clone --depth=1 https://github.com/wokwi/wokwi-elements.git \
third-party/wokwi-elements
cd apps/web && npm run generate:metadataAvailable Wokwi Components (48)
| Category | Components |
|---|---|
| Boards | Arduino Uno, Mega, Nano, ESP32 DevKit |
| Sensors | DHT22, HC-SR04, PIR, Photoresistor, NTC, Joystick |
| Displays | LCD 16x2, LCD 20x4, 7-Segment |
| Input | Push button, 6mm button, Slide switch, DIP switch 8, Potentiometer |
| Output | LED, RGB LED, LED bar graph, Buzzer, NeoPixel |
| Motors | Servo, Stepper motor |
| Passive | Resistor, Slide potentiometer, LED ring, Matrix keypad |
| Other | IR receiver, DS1307 RTC, breadboards, etc. |
How avr8js Powers the Simulation
1import { CPU, avrInstruction, AVRTimer, AVRUSART, AVRADC, AVRIOPort } from 'avr8js';
2
3const cpu = new CPU(programMemory); // ATmega328p at 16 MHz
4const portB = new AVRIOPort(cpu, portBConfig); // digital pins 8-13
5const portC = new AVRIOPort(cpu, portCConfig); // analog pins A0-A5
6const portD = new AVRIOPort(cpu, portDConfig); // digital pins 0-7
7
8function runFrame() {
9 const cycles = Math.floor(267_000 * speed);
10 for (let i = 0; i < cycles; i++) {
11 avrInstruction(cpu); // execute one AVR instruction
12 cpu.tick(); // advance timers + peripherals
13 }
14 requestAnimationFrame(runFrame);
15}Full details: See docs/WOKWI_LIBS.md in the repository.