Programming Arduino UNO Wifi

Hello,

I have just bought an Arduino UNO Wifi, and am trying to program it, using Arduino IDE 1.8.8 on a Mac. I was at first confused by the options in the IDE, under 'Boards': there is an 'Arduino UNO Wifi' under 'Arduino AVR Boards', and also an 'Arduino UNO Wifi Rev2' under 'Arduino megaAVR boards'. I tried both, but only the latter compiles when I start with the 'Blink' example. On the underside of the board it says 'Arduino UNO Wifi rev2', so that makes sense, I guess.
But when I try another example, using the Wifi libraries, I get an error.
The sketch is the 'HueBlink' example:

/* HueBlink example for ArduinoHttpClient library

   Uses ArduinoHttpClient library to control Philips Hue
   For more on Hue developer API see http://developer.meethue.com

  To control a light, the Hue expects a HTTP PUT request to:

  http://hue.hub.address/api/hueUserName/lights/lightNumber/state

  The body of the PUT request looks like this:
  {"on": true} or {"on":false}

  This example  shows how to concatenate Strings to assemble the
  PUT request and the body of the request.



   modified 15 Feb 2016 
   by Tom Igoe (tigoe) to match new API
*/

#include <SPI.h>
#include <WiFi101.h>
#include <ArduinoHttpClient.h>
#include "arduino_secrets.h"

///////please enter your sensitive data in the Secret tab/arduino_secrets.h
/////// Wifi Settings ///////
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;

int status = WL_IDLE_STATUS;      // the Wifi radio's status

char hueHubIP[] = "192.168.178.60";  // IP address of the HUE bridge
String hueUserName = SECRET_USER; // hue bridge username

// make a wifi instance and a HttpClient instance:
WiFiClient wifi;
HttpClient httpClient = HttpClient(wifi, hueHubIP);


void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial); // wait for serial port to connect.

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);
  }

  // you're connected now, so print out the data:
  Serial.print("You're connected to the network IP = ");
  IPAddress ip = WiFi.localIP();
  Serial.println(ip);
}

void loop() {
  sendRequest(3, "on", "true");   // turn light on
  delay(2000);                    // wait 2 seconds
  sendRequest(3, "on", "false");  // turn light off
  delay(2000);                    // wait 2 seconds
}

void sendRequest(int light, String cmd, String value) {
  // make a String for the HTTP request path:
  String request = "/api/" + hueUserName;
  request += "/lights/";
  request += light;
  request += "/state/";

  String contentType = "application/json";

  // make a string for the JSON command:
  String hueCmd = "{\"" + cmd;
  hueCmd += "\":";
  hueCmd += value;
  hueCmd += "}";
  // see what you assembled to send:
  Serial.print("PUT request to server: ");
  Serial.println(request);
  Serial.print("JSON command to server: ");

  // make the PUT request to the hub:
  httpClient.put(request, contentType, hueCmd);
  
  // read the status code and body of the response
  int statusCode = httpClient.responseStatusCode();
  String response = httpClient.responseBody();

  Serial.println(hueCmd);
  Serial.print("Status code from server: ");
  Serial.println(statusCode);
  Serial.print("Server response: ");
  Serial.println(response);
  Serial.println();
}

The error I get when I compile this is:

/Users/pmansvelder/Documents/Arduino/libraries/WiFi101/src/WiFiMDNSResponder.cpp:26:21: fatal error: strings.h: No such file or directory
compilation terminated.
exit status 1
Fout bij het compileren voor board Arduino Uno WiFi Rev2

I have updated all the libraries, but to no avail; does anybody have a suggestion?

Peter Mansvelder

use WiFiNINA library

Thanks, that did indeed sort out the problem, I do get some warnings still, though, but the program compiles fine and runs as desired.

In file included from /Users/pmansvelder/Documents/Arduino/arduino-sketches/HueBlink_Domus/HueBlink_Domus.ino:24:0:
/Users/pmansvelder/Library/Arduino15/packages/arduino/hardware/megaavr/1.6.24/libraries/SPI/src/SPI.h:51:0: warning: "EXTERNAL_NUM_INTERRUPTS" redefined
 #define EXTERNAL_NUM_INTERRUPTS   NUM_TOTAL_PINS
 ^
In file included from /Users/pmansvelder/Library/Arduino15/packages/arduino/hardware/megaavr/1.6.24/cores/arduino/UART.h:28:0,
                 from /Users/pmansvelder/Library/Arduino15/packages/arduino/hardware/megaavr/1.6.24/cores/arduino/Arduino.h:138,
                 from sketch/HueBlink_Domus.ino.cpp:1:
/Users/pmansvelder/Library/Arduino15/packages/arduino/hardware/megaavr/1.6.24/variants/uno2018/pins_arduino.h:40:0: note: this is the location of the previous definition
 #define EXTERNAL_NUM_INTERRUPTS     48