Skip to content

Problem with WiFiNINA.h #121

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
GitHubRea opened this issue Feb 26, 2020 · 9 comments
Closed

Problem with WiFiNINA.h #121

GitHubRea opened this issue Feb 26, 2020 · 9 comments
Assignees
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: language server Related to the Arduino Language Server type: imperfection Perceived defect in any part of project

Comments

@GitHubRea
Copy link

Describe the bug
problem with WiFi-Status constant.
see screenshot: arduino-pro-ide 0.0.5
image

But in Arduion 1.8.12 it is working fine
image

Desktop (please complete the following information):

  • OS: [macOS]
  • Version [10.15.3]
@ubidefeo
Copy link

hi @GitHubRea
Not really clear what the issue is.
If you are referring to the constant not being recognised this might be a minor issue.
Does the code compile and run properly?
If it does not compile and run then it's indeed a bug :)

Also, could you post the code in a snippet?
that allows us to test it doing copy/paste :)

@GitHubRea
Copy link
Author

GitHubRea commented Feb 27, 2020

Hello ubidefeo
sorry the delay.

here the code.
Thx

#include <SPI.h>
#include <WiFiNINA.h>

char ssid[] = "xxx";
char pass[] = "xxx";
int status = WL_IDLE_STATUS;
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x7D, 0x54 };

WiFiServer server(80);

void setup() {
  // initialize serial:
  Serial.begin(9600);
  Serial.println("Attempting to connect to WPA network...");
  Serial.print("SSID: ");
  Serial.println(ssid);

  status = WiFi.begin(ssid, pass);
  if ( status != WL_CONNECTED) { 
    Serial.println("Couldn't get a wifi connection");
    while(true);
  } 
  else {
    server.begin();
    Serial.print("Connected to wifi. My address:");
    IPAddress myAddress = WiFi.localIP();
    Serial.println(myAddress);

  }
}

void loop(void) {
WiFiClient client = server.available();

//two variables to hold your temperatures
float temperatureIndoor;
float temperatureOutdoor;

if (client) {
    Serial.println("new client");
    //an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connnection: close");
          client.println();
          
          temperatureIndoor = 22.77;
          temperatureOutdoor = 15.55;
        
          client.print("{\"arduino\":[{\"location\":\"indoor\",\"celsius\":\"");
          client.print(temperatureIndoor);
          client.print("\"},");
          client.print("{\"location\":\"outdoor\",\"celsius\":\"");
          client.print(temperatureOutdoor);
        
          client.print("\"}]}");
          client.println();
          break;
        }
        if (c == '\n') {
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          //you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
}

@ubidefeo
Copy link

@GitHubRea
It is working for me out of the box.
If you cannot compile or the IDE cannot see library definitions it might mean that you haven't installed any cores yet.
Check the README on the main GitHub page for this project and you'll see.
Let me know if this fixes your issue

The Arduino Pro IDE does not provide pre-installed cores, to have board support you have to install a core by using the menu

Tools -> Board Manager...

@GitHubRea
Copy link
Author

Hello ubidefeo,
you are right, it is not possible to compile. But I installed the needed core and library.(see attachments)
I am using the MKR Wifi 1010 port.

ArduinoProIde_1.pdf
ArduinoProIde_2.pdf

Thanks for the effort!

@ubidefeo
Copy link

ubidefeo commented Mar 1, 2020

unfortunately I cannot reproduce the issue,
let's see if someone else has an idea of what could be troubling your setup

@GitHubRea
Copy link
Author

Hello I am so sorry,

I found the problem for my issue.
I saved the project to an other folder, not in the Arduino basic root.
ArduinoIdePro_library.pdf
And in this project folder there is no library folder included.
I copied the library folder in this project folder. After that it was compiling.

So I think I should handle my projects in the installed root of Arduino.
ArduinoIdePro_correctFolder.pdf
What do you think?

Thanks a lot!

@GitHubRea
Copy link
Author

... is it possible to set the folder root of library somewhere in the ProIDE.
Because in standard IDE it is possible to save setches in other folders.
Thx and sorry for my boor english.

@ubidefeo
Copy link

@GitHubRea
I know it's been a long time, but this works for me on the latest Alpha 0.1.4

we're cleaning up old issues.
@per1234 I saw you can still replicate this, I have noticed that as soon as you trigger the Language Server by selecting a board it starts working for me

@rsora rsora transferred this issue from arduino/arduino-pro-ide Mar 1, 2021
@rsora rsora added the priority: medium Resolution is a medium priority label Mar 1, 2021
@cmaglie cmaglie removed the type: bug label Sep 16, 2021
@rsora rsora added type: imperfection Perceived defect in any part of project topic: language server Related to the Arduino Language Server labels Sep 22, 2021
@rsora rsora added criticality: medium Of moderate impact and removed priority: medium Resolution is a medium priority type: imperfection Perceived defect in any part of project labels Nov 2, 2021
@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Nov 3, 2021
@per1234
Copy link
Contributor

per1234 commented Nov 28, 2021

I am able to reproduce the issue of the incorrect language server results for the WiFiNINA library with older versions of the IDE (e.g. 2.0.0-beta.3), but not with 2.0.0-beta.12.

So I'll close this as fixed. If anyone is able to still reproduce the issue with the latest version of the IDE, please comment here with full details and I'll investigate.

Note: While attempting to bisect, I had annoying experiences of the bad state persisting into later IDE versions until I cleared the data folders, after which I could no longer reproduce the issue with those later IDE versions.

@per1234 per1234 closed this as completed Nov 28, 2021
@per1234 per1234 added the conclusion: resolved Issue was resolved label Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: language server Related to the Arduino Language Server type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

7 participants