Skip to content

Add a WOKWI_SIMULATOR macro! #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arduino12 opened this issue Dec 11, 2021 · 2 comments
Closed

Add a WOKWI_SIMULATOR macro! #238

arduino12 opened this issue Dec 11, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@arduino12
Copy link

Is your feature request related to a problem? Please describe.
It will be useful for many things..! - for example- when using tone -
the first call probably initializing somthing and it takes like 500ms to start producing the audio-
I found out that adding delay(1000) to the setup() function solve this issue - but it will be much nicer to wrap it in:

#ifdef WOKWI_SIMULATOR
delay(1000); // a start-up delay for the simulator to finish initializing audio stuff
#endif

So when I flash the same code with the Arduino-IDE - the delay(1000) will be omitted out.

Describe the solution you'd like
I want the Wokwi web simulator to add (in the background like the #include <Arduino.h>) a:
#define WOKWI_SIMULATOR or #define WOKWI_VERSION (2021) or something like that-
So the code can "know" if it is run inside the simulator or not by checking if this macro is defined..

@urish Many thanks for this geat tool! I have just discovered it today and will sure share my projects with it :)

@arduino12 arduino12 added the enhancement New feature or request label Dec 11, 2021
@urish
Copy link
Contributor

urish commented Dec 11, 2021

Thanks for opening the request! This is duplicate of #234, mind adding a comment with the details there?

@arduino12
Copy link
Author

Ohh my bad - I searched for the keyword "simulator" and the #234 issue didn't appeared.
Will add my comment there 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants