Giter VIP home page Giter VIP logo

wokwi-docs's Introduction

wokwi-docs

View online: https://docs.wokwi.com

Online Development

You can open a development environment in your browser, without having to install anything on your computer. The development environment lets you quickly preview your changes, and even commit them to GitHub and create a pull request.

Local Development

You'll need node.js and yarn. Clone this repo to your computer, then install the dependencies:

yarn install

Start the local development server:

yarn start

This will also open up a browser window with the docs site. Most changes are reflected live without having to restart the server.

License

This work is licensed under a Creative Commons Attribution 4.0 International License.

wokwi-docs's People

Contributors

arcostasi avatar ariellae avatar bonnyr avatar breakeryu avatar drcrowller avatar echtertill avatar fbseletronica avatar guy-michael avatar ishotjr avatar koepel avatar luke-oldenburg avatar matititam avatar mattvenn avatar miso-mosi avatar p-r-o-c-h-y avatar pe5er avatar pliski avatar sergiogasquez avatar slav-at-attachix avatar sutaburosu avatar timmathias avatar urish avatar vinimlo avatar vollbrecht avatar zhufree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wokwi-docs's Issues

WokWi part features and arguments

WokWi part features and arguments

The title on this was a bit difficult to make, as of 2023-05 the title tries to reflect information to put inside the diagram.json
However it may also include parameters to the WokWi editor in order to create a specific project.
And if there are issues with the .ino or cpp-files the same issue #176 may be used.

The page is not organized for now. It try to list moments, issues and ideas as it comes to my mind.
It will be irregularly updated as new issues and ideas arise or comments from others are made.
Not even sure if the belongs on this location on github, but for now this is the location.

To reference ore explain some elements late a section to examples will be included. Hopefully the examples are
as general to benefit others, if not, own projects may be included, or even test projects focusing on the issue.
The idea is that test projects will have a README.md, a commented .ino, and a crafted diagram.json

When comments or notes are available to the WokWi editor, those will be used as well.
And when ea project selection, or search page is later available to both logged in users and others, the plan it to add some tags to
information thet may be helpful for users. I also hope a beta-page and unsupported/not fully implemented page will be available to users. For now I try to make it here.

TOC

Manually created TOC, no links and not verified it is always updated

  • diagram.json
  • The esp and FastLED.
  • ...
  • Several links that may help me or others

diagram.json

Example showing the pixelate attribute

"parts": [
    {  
      "type": "wokwi-neopixel-canvas",      "id": "neopixels1",      "top": 950.07,      "left": 0,  
      "rotate": 0.000001,  
      "attrs": { "rows": "1", "cols": "60", "matrixBrightness": "10", "pixelate": "circle" }  
    },

some attributes and keys

  • Example to show key, flip and transperent wires in the drawing window.
    Note the ... is inserted to cut some lines, making the json-code invalid if you simply copy paste it.
"parts": [ ...
    {
      "type": "wokwi-pushbutton",      "id": "btn1", ...
      "rotate": -90,       "attrs": { "color": "red", "key": "t" }

      "id": "led1",      "attrs": { "color": "cyan", "flip": "" }
  ],
  "connections": [ ...
    [ "btn1:2.l", "uno:3", "goldTransp", [ "h0" ] ],
    [ "btn1:1.r", "uno:GND.1", "blackTransp", [ "v0" ] ],
    [ "Sec1:1", "Sec1:2", "Section1Transp", [ "*" ] ],
    [ "uno:5", "neopixels16:DIN", "orangeTransp", [ "v-14", "*", "v-8" ] ], ...

esp advanced keys and attributes 01

The esp is simulated in different was for esp, s2, s3 and c3. bootloader is not included with ordinary esp
If you like to use this feature then modify the attrs:-key. See example below

...
  "parts": [
    { "type": "wokwi-esp32-devkit-v1", "id": "esp", "top": 0, "left": 0, "attrs": { "fullBoot": "1" } },

The esp and FastLED.

Note no solutions, only information and some help
Also see this page for information: https://docs.wokwi.com/guides/esp32#simulation-features

.ino or c++ or cpp

#define FASTLED_FORCE_SOFTWARE_SPI
#include <FastLED.h>
// Message: /libraries/FastLED/src/fastspi.h:145: 
//    #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output

/** links to FastLED.
https://github.com/FastLED/FastLED/wiki/SPI-Hardware-or-Bit-banging
https://github.com/marmilicious/FastLED_2_Processing
*/
/* Info
  For the code to run as expected you may need to be careful with the pin-selections and prepare pins for SPI-use
*/
// ...
void fastledsetuo() {
  // Assuming all constants and variables are available tho the function
  // LED1 can only be an int literals constant. (unigned, int, long, byte, etc. is ok) 
  // creating an array like so:
  int LEDARRY[] = { 5, 6, 7}; // and referencin like so 
    LEDARRY[0] // is not the same as
  const int LED1 = 5; // or #define LED1 5
  FastLED.addLeds<LED_TYPE, LED1, COLOR_ORDER>(leds[0], NUM_LEDS).setCorrection( TypicalLEDStrip );
}
// Link to example is not included for now.

Several links that may help me or others

Some related to WokWi on github or othere WokWi related locations

https://github.com/wokwi/wokwi-boards
https://github.com/wokwi/wokwi-boards/tree/main/boards
https://github.com/wokwi/wokwi-elements
https://github.com/wokwi/wokwi-elements/tree/master/src
https://github.com/wokwi/splendida
https://elements.wokwi.com/?path=/story/resistor--470%CF%89
Issue: ESP32S3 Servo wokwi/wokwi-features#570
https://docs.wokwi.com/guides/esp32

Some projects

No explanation or information for now. Simply a list of projects
https://wokwi.com/projects/312460386125218368
https://wokwi.com/projects/342634722692694610
https://wokwi.com/projects/363419673189621761

Others

https://docs.github.com/en/get-started/writing-on-github
https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet

SevenSegmentTM1637 library and the Docs.

(1)
The SevenSegmentTM1637 library has a problem. A bug was fixed, but the library version was not updated. Therefor the Arduino IDE and Wokwi take in the version with the bug. Some examples run in Wokwi, but if an other example is tried then it does no longer work.
New users could be confused.

The library: https://github.com/bremme/arduino-tm1637
The bug is the word "bouchingBall" (a missing 'n') in the file SevenSegmentFun.h

Should the example with the library be removed from the Docs ? https://docs.wokwi.com/parts/wokwi-tm1637-7segment

(2)
In the Docs is the text: "Here are some TM1637 libraries you can use on Arduino: [email protected], Grove 4-Digit Display".
I don't know what that means.

SPI documentation on Mega has an error.

On the list of pin names Pin 53 is NOT SPI chip select. It is SPI Command/Data. Luckily I had the original we did as an example to check.

Oh, and it high lites the wrong pin processor board <-> SD board. That'l have to be fixed as well.

-jim lee

Serial.println stops working when accessing a structure in a structure?

https://wokwi.com/arduino/projects/306622481699963457

During setup(), a call's made to addFadeToQueue. On line 122, just after:

fadeLEDs[led].fadeQueue[head].startRGB.r = d.startRGB.r;
Serial.println("This isn't displayed");
return; // early return

The Serial.println command stops outputting anything. I have no idea why.

If I put it BEFORE line 122, it displays fine.

Serial.println("This isn't displayed");
return; // early return
fadeLEDs[led].fadeQueue[head].startRGB.r = d.startRGB.r;

It really bodges my attempts at super basic debugging practices. (Still learning GDB)

bug: update custom chip API documentation to reflect what's supported for controls

Describe the bug
The current documentation indicates that there can be a controls section in the chip.json file to enable dynamic input from
users. It does not specify however how this is structured or what types of controls are available

To Reproduce
See current doc (https://docs.wokwi.com/chips-api/attributes)

Expected behavior
A clear and concise description of what you can do with attributes.

For example, for toggles, perhaps -

Toggle attributes (flags) can be controlled at runtime using the following control parameters:

{
        "id": "ow_debug",
        "label": "OneWire Debug control",
        "type": "range",
        "min": 0,
        "max": 1,
        "step": 1
      }

or if we can have support for booleans:

{
        "id": "ow_debug",
        "label": "OneWire Debug control",
        "type": "boolean",
 }

This should also be applicable to string attributes

Environment (please complete the following information):

  • NA

Additional context
NA

Scrolling issue

I was having this problem with scrolling in the Wokwi docs.

Solution: I turned disabled the option Experimental Web Platform features
(chrome://flags/#enable-experimental-web-platform-features))

More details: Scrolling issue since beta.15

wokwi-text missing as standard-part

In some projects i found the part "wokwi-text" for labeling parts. Why isn't such a basic thing in the parts-list? If there is a hotkey to input texts - i haven't found it / won't remember it long ;-)
So now i copy/paste this part from old projects an edit it in the .json...

best regards
Bernhard

Improving the documentation about the serial monitor

The Wiki of Woki about the serial monitor is not detailed enough
https://docs.wokwi.com/guides/serial-monitor#display
there is a missing comma at the end of the code

"serialMonitor": { "display": "auto", "newline": "lf" }

behind the closing curly bracket there is a comma needed.
"serialMonitor": { "display": "auto", "newline": "lf" },

Even better would be to show not only this code-snippet you have to insert but to show a short but completed JSON-file to make visible where and how to insert the serialMonitor-section.

That I have to write this issue is caused by an effect I call "the expert-blindness-for-beginners-difficulties"
To somebody who knows JSON-files very well the short description is enough. But not for beginners.

If your help-files shall be really helpful review them from the knowledge of a real beginner
best regards Stefan

List of supported hardware

I got aware of this project by a news article today. Just had a quick look for now and I couldn't find out what devices the simulator supports, especially MCUs. I'm primarily using ESP32 and ATtiny1614. The latter is a relatively modern AVR 8-bit MCU that has some differences to the older Arduino models. I suggest adding a list of supported devices somewhere in the documentation, maybe link to it from the FAQ page.

Description and example code for KY-040 encoder does not reflect operation of actual device

Re this page:

           https://docs.wokwi.com/parts/wokwi-ky-040

Is it your intent that the simulation of the KY-040 exactly match the behavior of the actual device? If that is the intent, then both the description (in the Operation section) and the associated example code (first example under Reading the rotation) are incorrect: The stated description does not reflect the behavior of the actual device, and the associated example code will not work correctly on the actual device.

I would be happy to provide a pull request with corrections that bring the description and the code into agreement with actual device behavior, but first wanted to ask whether it is even your intent that the simulation match the actual device behavior. Perhaps your intent is only that the simulation behave in a functionally similar way, but not mimic the device exactly....?

feature-request: making the simulator even more realistic

The Wokwi-Simulator offers servos.
This is good, but I have a feature-request:

Real servos need a lot of current. Much more current than an Arduino-onboard-voltage-regulator can offer.
If newcomers that are unexperienced with electronics and build the real thing connected to the Arduinos 5V-pin
The voltage-regulator will do the "magic smoke".

So a really realistic simulation would let burn the arduino's voltage-regulator like the batteries in the DC-Lab of the PHET DC-Lab simulation
image

http://phet.colorado.edu/sims/html/circuit-construction-kit-dc-virtual-lab/1.1.5/circuit-construction-kit-dc-virtual-lab_all.html
best regards Stefan

Proposal for LDR module: check for infinite value

The documentation for the LCD module and the Analog Demo show a short calculation.
https://docs.wokwi.com/parts/wokwi-photoresistor-sensor

The Analog Demo works as it is, but with different parameters or in real life, the lux could be a 'inf' float value when analogRead() returns zero. That 'inf' value will be displayed as 0 lux.

My proposal is to add a note to the documentation and perhaps also change the Analog Demo.
The isfinite() seems to be the right way to check it according this: https://www.gnu.org/software/libc/manual/html_node/Floating-Point-Classes.html

In my test sketch ( https://wokwi.com/projects/361196415746754561 ) I have different parameters to force the analogRead() to return zero.

  if(isfinite(lux))
  {
    Serial.print("The brightness is ");
    Serial.print(lux);
    Serial.println(" lx");
  }
  else
  {
    Serial.println("Too bright to measure");
  }

adding explicit examples that show the use of the attributes in EACH example-code

Hi,
the headline says it all
adding explicit examples that show the use of the attributes in EACH example-code

The example for the PIR-Sensors has empty attributes
{ "type": "wokwi-pir-motion-sensor", "id": "pir1", "top": -42, "left": 25.81, "attrs": {} },

that is a somehow bad example as it dos NOT explain how to use the attributes
you should add an example that shows all attributes
If you show it like in the picture below a user can learn

  • where to find the attributes (diagram-json-tab)
  • and what syntax the content of the attributes section must have to make it work with multiples attributes (comma-separated

grafik

typos on uart page

On https://docs.wokwi.com/chips-api/uart
probably want to replace "on the TX" at
// byte is the byte received on the TX pin
with either from the TX or on the RX.
More importantly

const uart_config_t uart1 { .tx = pin_init("TX", INPUT_PULLUP), .rx = pin_init("RX", INPUT), // ...
needs an assigment "uart1 = {" to build.

[Documentation] Examples for connecting a button to a Arduino board.

I noticed that new users don't know how to connect a button.
Could these examples be added to the documentation for the push button ?

Documenation: https://docs.wokwi.com/parts/wokwi-pushbutton
Button Example One (active high) - A basic example for connecting a button. https://wokwi.com/projects/397990618860958721
Button Example Two (active low) - A basic example for connecting a button. https://wokwi.com/projects/397990611031240705

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.