Hey, I got a grove GPS (Air530) unit and I was trying the sample code in the grove wiki and I keep getting this error:
/var/run/arduino/custom-libraries/VEGA_SoftwareSerial/src/SoftwareSerial.cpp:11:10: fatal error: util/delay_basic.h: No such file or directory
#include <util/delay_basic.h>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
I just can't find util/delay_basic.h anywhere, PLEASE HELP!!
Why do you think you need that library?
Leave out the #include and see if the compiler complains about undefined functions.
Post the results.
By the way, Seeed Studio offers customer support for their products, and they would be the best source of advice.
Hi @isaac_boyd. We will need some additional information in order to be able to effectively assist you.
Please add a reply here on the forum topic to tell us exactly which Arduino board you are using.
Please also provide a link to the code.
I was using a MKR WIFI 1010, I was using the cloud editor, and here's the code I was using:
#include <SoftwareSerial.h>
SoftwareSerial SoftSerial(2, 3);
unsigned char buffer[64]; // buffer array for data receive over serial port
int count=0; // counter for buffer array
void setup()
{
SoftSerial.begin(9600); // the SoftSerial baud rate
Serial.begin(9600); // the Serial port of Arduino baud rate.
}
void loop()
{
if (SoftSerial.available()) // if date is coming from software serial port ==> data is coming from SoftSerial shield
{
while(SoftSerial.available()) // reading data into char array
{
buffer[count++]=SoftSerial.read(); // writing data into array
if(count == 64)break;
}
Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (Serial.available()) // if data is available on hardware serial port ==> data is coming from PC or notebook
SoftSerial.write(Serial.read()); // write it to the SoftSerial shield
}
void clearBufferArray() // function to clear buffer array
{
for (int i=0; i<count;i++)
{
buffer[i]=NULL;
} // clear all index of array with command NULL
}
OK, that makes the problem clear.
Support is added to the Arduino development tools (e.g., Arduino Cloud Editor, Arduino IDE) by a collection of code called a "platform". The platform of certain boards (e.g., UNO R3) contains a library named "SoftwareSerial". The code you found uses that library:
The platform of the MKR WiFi 1010 does not contain a "SoftwareSerial" library. Because of that, Arduino Cloud Editor searched through all the thousands of Library Manager libraries that are pre-installed on the Arduino Cloud server to find one that contains a file named SoftwareSerial.h. The one it happened to find is the "VEGA_SoftwareSerial" library, so it used that library while compiling the sketch.
The VEGA_SoftwareSerial library is written for use with the "Aries" boards, which have a different platform and architecture than the MKR WiFi 1010. For this reason, the VEGA_SoftwareSerial library is incompatible with the MKR WiFi 1010 board and thus it is expected that compiling that library for the MKR WiFi 1010 board will fail.
The reason a "SoftwareSerial" library was not added to the MKR WiFi 1010 board's platform is that, unlike boards like the UNO R3 that only have one hardware serial port which is already dedicated to communication with the computer, the MKR WiFi 1010 board has a free hardware serial port on pins 13 and 14.
So the solution will be to connect the GPS unit to pins 13 and 14 on the board and then change the code to use Serial1 hardware serial port object instead of the "SoftwareSerial" library.
You can learn about using Serial1 from the Arduino Language Reference:
https://docs.arduino.cc/language-reference/en/functions/communication/serial/
If you have any problems or questions while adapting the code, you are welcome to come back here to the forum with your updated sketch code and the forum helpers will provide assistance.
I have never used Serial1 and I have no clue what I'm doing, could you give the changed code?
Arduino is about learning. If I write the code for you, then you will lose the opportunity to learn. We are here to help, but most of us don't like to do the project for you. I'm certain you can achieve success with some perseverance.
The important thing to understand is that Serial1 is used exactly the same as Serial. They only communicate over serial pins. So any general information you find about using Serial in Arduino sketches is also applicable to Serial1.
I tried my Uno R4 WIFI and the the sample code, and I got it works now but I can't figure out how to read the data, but I'll figure that out sometime, but I got it to work!
Great work! Thanks for the update.
As you probably noticed, the Arduino boards platform for the UNO R4 WiFi board does contain a SoftwareSerial library, so when you compile the same code for the UNO R4 WiFi board, Arduino Cloud Editor is able to find a compatible library to use instead of resorting to the VEGA_SoftwareSerial library (which would also be incompatible with the UNO R4 WiFi).