Skip to content
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

Error message appearing even though LED is connected properly #470

Closed
rinon13 opened this issue Feb 17, 2023 · 1 comment
Closed

Error message appearing even though LED is connected properly #470

rinon13 opened this issue Feb 17, 2023 · 1 comment

Comments

@rinon13
Copy link
Contributor

rinon13 commented Feb 17, 2023

Description: A pop up error message "LED is not Connected properly" is showing on right hand side of screen even though LED is connected properly.

Steps to Reproduce:

image

  1. Connect circuit as shown above.
  2. Copy .ino code
int  POS_PIN = 13;
int NEG_PIN = 12;

void setup(){
    pinMode(POS_PIN, OUTPUT);
    pinMode(NEG_PIN, OUTPUT);
    digitalWrite(NEG_PIN, LOW);
}

void loop(){
    digitalWrite(POS_PIN, HIGH);
    delay(500);
    digitalWrite(POS_PIN, LOW);
    delay(500);
}
  1. Press "Start Simulation"
  2. Error message will appear on top right of screen

Expected behavior: Error message should not appear when LED is connected to digital pins which are programmed correctly (.ino code is written correctly) i.e POSITIVE pin is given HIGH and NEGATIVE pin is given LOW

Error example:

LED_Error_Message

  • OS: Ubuntu 22.04.1 LTS
  • Browser: Firefox 110

Tested on:

Reason for error:

  1. When "Start Simulation" is pressed, LED's simulation function is called before Arduino's simulation function.
    (LED is of type output)
    (Code at eSim-Cloud/ArduinoFrontend/src/app/Libs/Workspace.ts) (Line 1045)
// Sequence to be followed while calling initSimulation
    const seqn = ['output', 'general', 'controllers', 'drivers', 'power', 'input', 'misc'];
    // For each component call initsimulation function
    for (const key of seqn) {
      for (const items of Utils.componentBox[key]) {
        for (const item of items) {
          if (window.scope[item]) {
            for (const ele of window.scope[item]) {
              if (ele.initSimulation) {
                ele.initSimulation();
              }
            }
          }
        }
      }
    }
  1. When LED tries to read the values of connected Arduino pins, they have not been initialized yet.
  2. This causes the checks to see if LED is connected properly to not be satisfied.

Additional information:

The error message only stays for a short while and will go away after the values of the Arduino pins have been initialized.

Error_Gone2

@firuza
Copy link
Collaborator

firuza commented Mar 3, 2023

Fixed in #467

@firuza firuza closed this as completed Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants