In Arduino IDE 1.8.12, using board Artemis Micro Mod with the Ambiq Bootloader (Recommended). The “Sparkfun Apollo3 Boards” version is 2.0.2 in Boards Manager.
If I try to verify the Examples > Ethernet > WebClientRepeating example, I get the error below in the Arduino IDE.
If I change to Arduino Uno as the board, the program verifies fine.
Everything else with Artemis Micro Mod has been really great, and it’s been a total bummer I can’t get this to work. Any help would be greatly appreciated. Is there a way to get Ethernet working in any way on the Artemis Micro Mod? I believe my ethernet module is a Wiznet W5500 connected with SPI.
WebClientRepeating:38:1: error: 'EthernetClient' does not name a type; did you mean 'EthernetClass'?
EthernetClient client;
^~~~~~~~~~~~~~
EthernetClass
C:\Users\sdelu\AppData\Local\Temp\arduino_modified_sketch_300391\WebClientRepeating.ino: In function 'void setup()':
WebClientRepeating:49:3: error: 'Ethernet' was not declared in this scope
Ethernet.init(5); // MKR ETH shield
^~~~~~~~
WebClientRepeating:66:38: error: 'EthernetNoHardware' was not declared in this scope
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
^~~~~~~~~~~~~~~~~~
C:\Users\sdelu\AppData\Local\Temp\arduino_modified_sketch_300391\WebClientRepeating.ino:66:38: note: suggested alternative: 'EthernetClass'
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
^~~~~~~~~~~~~~~~~~
EthernetClass
WebClientRepeating:72:34: error: 'LinkOFF' was not declared in this scope
if (Ethernet.linkStatus() == LinkOFF) {
^~~~~~~
C:\Users\sdelu\AppData\Local\Temp\arduino_modified_sketch_300391\WebClientRepeating.ino: In function 'void loop()':
WebClientRepeating:91:7: error: 'client' was not declared in this scope
if (client.available()) {
^~~~~~
C:\Users\sdelu\AppData\Local\Temp\arduino_modified_sketch_300391\WebClientRepeating.ino:91:7: note: suggested alternative: 'dirent'
if (client.available()) {
^~~~~~
dirent
C:\Users\sdelu\AppData\Local\Temp\arduino_modified_sketch_300391\WebClientRepeating.ino: In function 'void httpRequest()':
WebClientRepeating:108:3: error: 'client' was not declared in this scope
client.stop();
^~~~~~
C:\Users\sdelu\AppData\Local\Temp\arduino_modified_sketch_300391\WebClientRepeating.ino:108:3: note: suggested alternative: 'dirent'
client.stop();
^~~~~~
dirent
exit status 1
'EthernetClient' does not name a type; did you mean 'EthernetClass'?
Here is the example’s code for reference:
/*
Repeating Web client
This sketch connects to a a web server and makes a request
using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
the Adafruit Ethernet shield, either one will work, as long as it's got
a Wiznet Ethernet module on board.
This example uses DNS, by assigning the Ethernet client with a MAC address,
IP address, and DNS address.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 19 Apr 2012
by Tom Igoe
modified 21 Jan 2014
by Federico Vanzati
http://www.arduino.cc/en/Tutorial/WebClientRepeating
This code is in the public domain.
*/
#include <SPI.h>
#include <Ethernet.h>
// assign a MAC address for the ethernet controller.
// fill in your address here:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1);
// initialize the library instance:
EthernetClient client;
char server[] = "www.arduino.cc"; // also change the Host line in httpRequest()
//IPAddress server(64,131,82,241);
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 10*1000; // delay between updates, in milliseconds
void setup() {
// You can use Ethernet.init(pin) to configure the CS pin
Ethernet.init(0);
//Ethernet.init(10); // Most Arduino shields
//Ethernet.init(5); // MKR ETH shield
//Ethernet.init(0); // Teensy 2.0
//Ethernet.init(20); // Teensy++ 2.0
//Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet
//Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet
// start serial port:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// start the Ethernet connection:
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
while (true) {
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip, myDns);
Serial.print("My IP address: ");
Serial.println(Ethernet.localIP());
} else {
Serial.print(" DHCP assigned IP ");
Serial.println(Ethernet.localIP());
}
// give the Ethernet shield a second to initialize:
delay(1000);
}
void loop() {
// if there's incoming data from the net connection.
// send it out the serial port. This is for debugging
// purposes only:
if (client.available()) {
char c = client.read();
Serial.write(c);
}
// if ten seconds have passed since your last connection,
// then connect again and send data:
if (millis() - lastConnectionTime > postingInterval) {
httpRequest();
}
}
// this method makes a HTTP connection to the server:
void httpRequest() {
// close any connection before send a new request.
// This will free the socket on the WiFi shield
client.stop();
// if there's a successful connection:
if (client.connect(server, 80)) {
Serial.println("connecting...");
// send the HTTP GET request:
client.println("GET /latest.txt HTTP/1.1");
client.println("Host: www.arduino.cc");
client.println("User-Agent: arduino-ethernet");
client.println("Connection: close");
client.println();
// note the time that the connection was made:
lastConnectionTime = millis();
} else {
// if you couldn't make a connection:
Serial.println("connection failed");
}
}