I just bought this sensor SparkFun Ultrasonic Distance Sensor - TCT40 SEN-24805 and trying to run the demo
the library download link in the tutorial failed when I clicked on it,
https://codeload.github.com/sparkfun/SparkFun_Qwiic_Ultrasonic_Arduino_Library/zip/refs/heads/v10
404: Not found
So I opened the arduino library manager and searched for “SparkFun Qwiic Ultrasonic”
trying to compile example 1 I get an error
\Arduino\libraries\SparkFun_Qwiic_Ultrasonic_Arduino_Library\src\sfeQwiicUltrasonic.cpp:93:24: error: ‘class sfeTkII2C’ has no member named ‘writeRegion’
err = _theBus->writeRegion(toWrite, numBytes);
when I looked at the file properties of the file I see it in the library folder: sfeQwiicUltrasonic.cpp is dated 6/12/2024
thanks
Sorry about the dead links; they’re updated now Software Setup - SparkFun Ultrasonic Distance Sensor - TCT40 (Qwiic) Hookup Guide
Try starting over with that library and re-attempt
I manually deleted the arduino library and from the SF web page clicked on the software setup, it downloaded a zip which I unzipped and placed in the arduino library folder. I am still getting this error trying to compile (using a SF blackboard, board type = UNO)
C:\Users.…\Documents\Arduino\libraries\SparkFun_Qwiic_Ultrasonic_Arduino_Library-main\src\sfeQwiicUltrasonic.cpp:93:24: error: ‘class sfeTkII2C’ has no member named ‘writeRegion’
err = _theBus->writeRegion(toWrite, numBytes);
^~~~~~~~~~~
You might need to try either an updated or downgraded Arduino IDE and/or try uninstalling & wiping the arduino15 folder like so https://support.arduino.cc/hc/en-us/articles/360021325733-Uninstall-Arduino-IDE - be sure to perform the “Removing additional files” steps, then try re-installing/starting over and see how it goes
that sounds like a big hammer and I am afraid of breaking other projects can you tell me what version of the IDE SF compiled it with ? thanks
when I searched the sfeQwiicUltrasonic.cpp for writeRegion I only found that one line. Is it possible it needs a pre-req library ? a google search for writeRegion did not find anything.
// Write the new address to the device
err = _theBus->writeRegion(toWrite, numBytes);
I commented that line out in the cpp file and the example code runs fine. I know that is not a best practice but for now it gets me going. Are you the author of that code ? sfeQwiicUltrasonic.cpp Perhaps they may know what that line does or references. thanks
Glad to hear it’s working! Yea, I’m not certain what it refers to either but happy to see a simple comment-out worked
That’s odd, do you think that you can show/send me the version of the “SparkFun Toolkit” that you’re using? For example when I compile the first example it reads SparkFun Toolkit 0.9.2:
I believe, for whatever reason, your Toolkit version is not the latest. You can easily fix this by searching for the “SparkFun Toolkit” in the Arduino Library Manager. After you do that, un-comment the troubling line and give that a shot.
Thanks!
that did it ! thank you! my version was 0.9.1, once I updated it to 0.9.2 it compiles.
curious looks like you compiled that in a command window, is that available in the standard IDE install ? I am using win 10. I liked how it display the libraries it used
Also I went back to the sf guide and did not see that toolkit library pre-req mentioned, may want to update the doc, thanks
That’s great! I’ll definitely shoot this over to the documentation team. Yeah that image is the
arduino-cli on my PC running Linux. I have not yet tried it on Windows, but it is available.
thanks again for your help !!!