danderflieger / aoa_arduino

Arduino code for the home-built Angle of Attack Sensor/Indicator
MIT License
0 stars 0 forks source link

Compiling error #2

Open Richrfl opened 1 year ago

Richrfl commented 1 year ago

I am trying to start with the code for Arduino, and on verification. This line is giving me some problems "AMS_5600 ams5600;". the error code I get is this: B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:28:1: error: 'AMS_5600' does not name a type; did you mean 'AS5600'? AMS_5600 ams5600; ^~~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino: In function 'void printMenu()': B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:67:74: error: 'ams5600' was not declared in this scope SERIAL.print("Number of burns remaining: "); SERIAL.println(String(3 - ams5600.getBurnCount())); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:67:74: note: suggested alternative: 'AS5600' SERIAL.print("Number of burns remaining: "); SERIAL.println(String(3 - ams5600.getBurnCount())); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino: In function 'float convertScaledAngleToDegrees(word)': B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:95:19: error: 'ams5600' was not declared in this scope word startPos = ams5600.getStartPosition(); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:95:19: note: suggested alternative: 'AS5600' word startPos = ams5600.getStartPosition(); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino: In function 'arduino::String burnAngle()': B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:131:20: error: 'ams5600' was not declared in this scope int burnResult = ams5600.burnAngle(); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:131:20: note: suggested alternative: 'AS5600' int burnResult = ams5600.burnAngle(); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino: In function 'arduino::String burnMaxAngleAndConfig()': B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:164:20: error: 'ams5600' was not declared in this scope int burnResult = ams5600.burnMaxAngleAndConfig(); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:164:20: note: suggested alternative: 'AS5600' int burnResult = ams5600.burnMaxAngleAndConfig(); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino: In function 'void loop()': B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:220:12: error: 'ams5600' was not declared in this scope if(ams5600.detectMagnet()==1) ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:220:12: note: suggested alternative: 'AS5600' if(ams5600.detectMagnet()==1) ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:229:12: error: 'ams5600' was not declared in this scope if(ams5600.detectMagnet()==1) ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:229:12: note: suggested alternative: 'AS5600' if(ams5600.detectMagnet()==1) ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:238:12: error: 'ams5600' was not declared in this scope if(ams5600.detectMagnet()==1) ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:238:12: note: suggested alternative: 'AS5600' if(ams5600.detectMagnet()==1) ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:247:77: error: 'ams5600' was not declared in this scope lastResponse = ("Max angle range= "+String(convertRawAngleToDegrees(ams5600.getMaxAngle()), DEC)); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:247:77: note: suggested alternative: 'AS5600' lastResponse = ("Max angle range= "+String(convertRawAngleToDegrees(ams5600.getMaxAngle()), DEC)); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:253:74: error: 'ams5600' was not declared in this scope lastResponse = ("Start angle = "+String(convertRawAngleToDegrees(ams5600.getStartPosition()), DEC)); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:253:74: note: suggested alternative: 'AS5600' lastResponse = ("Start angle = "+String(convertRawAngleToDegrees(ams5600.getStartPosition()), DEC)); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:259:73: error: 'ams5600' was not declared in this scope lastResponse = "End angle = " + String(convertRawAngleToDegrees(ams5600.getEndPosition()),DEC); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:259:73: note: suggested alternative: 'AS5600' lastResponse = "End angle = " + String(convertRawAngleToDegrees(ams5600.getEndPosition()),DEC); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:265:72: error: 'ams5600' was not declared in this scope lastResponse = "Raw angle = "+ String(convertRawAngleToDegrees(ams5600.getRawAngle()),DEC); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:265:72: note: suggested alternative: 'AS5600' lastResponse = "Raw angle = "+ String(convertRawAngleToDegrees(ams5600.getRawAngle()),DEC); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:271:77: error: 'ams5600' was not declared in this scope lastResponse = "Scaled angle = "+String(convertScaledAngleToDegrees(ams5600.getScaledAngle()),DEC); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:271:77: note: suggested alternative: 'AS5600' lastResponse = "Scaled angle = "+String(convertScaledAngleToDegrees(ams5600.getScaledAngle()),DEC); ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:277:12: error: 'ams5600' was not declared in this scope if(ams5600.detectMagnet()==1) ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:277:12: note: suggested alternative: 'AS5600' if(ams5600.detectMagnet()==1) ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:287:12: error: 'ams5600' was not declared in this scope if(ams5600.detectMagnet()==1) ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:287:12: note: suggested alternative: 'AS5600' if(ams5600.detectMagnet()==1) ^~~ AS5600 B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:308:62: error: 'ams5600' was not declared in this scope lastResponse = "Automatic Gain Control = " + String(ams5600.getAgc(),DEC); ^~~ B:\Docs\Arduino\Examples\aoa_arduino-main\aoa_arduino-main\Seeed_Arduino_AS5600-master\Seeed_Arduino_AS5600-master\examples\fullFunction\fullFunction.ino:308:62: note: suggested alternative: 'AS5600' lastResponse = "Automatic Gain Control = " + String(ams5600.getAgc(),DEC); ^~~ AS5600

exit status 1

Compilation error: 'AMS_5600' does not name a type; did you mean 'AS5600'?

Has this been a typo error or there is a library missing? The libraries I have in the code are:

include // library required for I2C communications

include // library for the AS5600 magnetic rotational encoder

include

I tried also the example "fullFunction" and I got the same problem.

I want to implement this project in a radio controlled model, as a telemetry sensor.

danderflieger commented 1 year ago

This sounds like a really cool project!

It sounds like you don't have the Seeed Arduino AS5600 library installed into your Arduino IDE.

If you look at the git repository (https://github.com/danderflieger/aoa_arduino) there is a zip file called Seeed_Arduino_AS5600-master.zip - it's right on the root of the repository. If you have cloned the git repository, it's wherever you cloned it to. If not, just download it from github to your computer (save it somewhere you can find it again).

On the Arduino IDE, click Sketch -> Include Library -> Add .ZIP Library ... and select the zip file mentioned above. This action adds the library to the Arduino Sketch so it can be used for your program.

Let me know if that clears up this issue. If it does, I'll add the instructions on the repository's README.md file so it's more clear for others.

Richrfl commented 1 year ago

I was missing this library, but regardless, I keep getting the same error message. Assuming I did it wrong, I tried to add it again, but the response was "Grove_AS5600 already exists, do you want to overwrite it?" Now, if I make a search in "Manage Libraries" under "Grove" in "Installed", I get no results. If I change the search to "All" I get a lot of Grove, but none of them as Grove_AS5600. Any idea?

On Sat, Oct 21, 2023 at 7:20 AM Dan Der Flieger @.***> wrote:

It sounds like you don't have the Seeed Arduino AS5600 library installed into your Arduino IDE.

If you look at the git repository ( https://github.com/danderflieger/aoa_arduino) there is a zip file called Seeed_Arduino_AS5600-master.zip - it's right on the root of the repository. If you have cloned the git repository, it's wherever you cloned it to. If not, just download it from github to your computer (save it somewhere you can find it again).

On the Arduino IDE, click Sketch -> Include Library -> Add .ZIP Library ... and select the zip file mentioned above. This action adds the library to the Arduino Sketch so it can be used for your program.

Let me know if that clears up this issue. If it does, I'll add the instructions on the repository's README.md file so it's more clear for others.

— Reply to this email directly, view it on GitHub https://github.com/danderflieger/aoa_arduino/issues/2#issuecomment-1773760539, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHVFBXPJH57S3L7CG7B6WDYAOVYDAVCNFSM6AAAAAA6KB3OM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZTG43DANJTHE . You are receiving this because you authored the thread.Message ID: @.***>

-- Richard

danderflieger commented 1 year ago

Hmm. Yeah, I don't use any Grove libraries. I assume you were testing things with Grove's AS5600 library and then moved over to my code?? There's probably a library mismatch - e.g. when you import the library with this line:

include

it seems like it's actually attempting to pull a file with the same name from a different library (probably one that was imported previously) rather than from the Seeed_Arduino_AS5600-master.zip file I mentioned before. So you probably need to clean up your your C:\users[user name]\Documents\Arduino\libraries\ directory. That's where the Arduino IDE keeps all of its imported libraries.

Anyway ... I just grabbed a new clone of my git repository and compiled it with no issues. You may want to consider doing the same - and make sure you get rid of any unnecessary libraries in the directory I mentioned above.

You may also want to ensure you're compiling for the correct board. Lately I've been working with the old, standard Arduino Nano boards (e.g. just a plain Arduino Nano board - NOT the Nano 33 BLE, the Nano 33 IoT, or Nano RP2040 boards that this project was designed for) and when I attempted to compile I got errors (very different from yours, but errors nonetheless).

Just out of curiosity, are you planning to use the Bluetooth functionality in your project? If not, a lot of this code is probably worthless to you. Simply requesting angle data from the AS5600 over I2C is pretty simple without the complexity of a Bluetooth connection. I mostly ask because for an RC model, the Bluetooth connection probably won't give you very much distance. You may want to look into a Zigbee or Lora radio to just pass angle data back to your ground station where you'd collect it and do something else with it. But even that might be a bit complex and it's definitely outside the scope of my project. Just a thought. :)

Richrfl commented 1 year ago

I have a real mess with the directories, as I was changing the directory depending on the board I was using. (Arduino/ESP32). I guess I will have to set everything back to the directory you said the libraries should be in and start up from there. I will have to drop this project for some time as I have other more urgent to attend. I will touch base when I can get back into this one.

Richrfl commented 1 year ago

Thank you for your response. I will follow your suggestion of cleaning up the library, although I have some doubts about that, but nothing its impossible. Also, you have a good point in reference to the blue tooth. All I will have to do is to integrate the SPort protocol into the Arduino and the receiver will take care of sending the data back to the transmitter through the telemetry channel. Also, I am compiling on Arduino Nano 33BLE. After the clean-up and re-load of the required libraries for your code, I will let you know if that worked or not. After I have a good compilation, I will start removing the Bluetooth and any other parts that I will not be using from the original code.