Arduino - Robot Car Kit with NewPing.h library - c

I downloaded the NewPing.h library and included them in the arduino library folder but I still getting this error:
N:\Arduino\avoi\avoi.ino:3:21: fatal error: NewPing.h: No such file or directory
#include <NewPing.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

Go to the Arduino IDE, in the top go to Sketch -> Include Library -> Manage Libraries...
Then search for NewPing, and install the only one that shows.
After that you're done you can use the header like so:
#include <NewPing.H>
Hope it helps.

To check the correct syntaxis go to Arduino IDE > File > Examples and search for newping examples (they will appear if newping library is installed) if not go to Sketch > Include Library > Manage Libraries > Search for newping > install

Related

VCPKG, not a found command right after installing it?

I am trying to use #include<graphics.h> in visual studio code to display graphics in C. When I used graphics.h as a header the following error occurred,
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\natha\Desktop\My OS\src\impl\kernel\main.c).C/C++(1696)
cannot open source file "graphics.h"
So as the quick fix suggests it shows me how to install a library for this header with VCPKG (https://vcpkg.io/en/getting-started.html). When I follow the steps by cloning the repository and running the bootstrap, I go to install the graphics package but the cmd says that 'vcpkg' is not a found command. I'm not sure why it says this or how to fix it.
Add the vcpkg.exe binary path to the PATH environment variable
or run vcpkg from the directory where you installed

How do I include VL53L0X headers into my STM32L project

Language: C
MCU: STM32L151C8T6
IDE: Atollic TRUEstudio
Library: https://www.st.com/content/st_com/en/products/embedded-software/proximity-sensors-software/stsw-img005.html
Problem: "fatal error: vl53l0x_api.h: No such file or directory #include "vl53l0x_api.h"
I have included the library(core & platform folder) that was extracted from "en.STSW-IMG005" into my project, I have checked my [build settings > include directories] and both the folders are there, however it keeps failing to compile.
It always show "fatal error: vl53l0x_api.h" but it jumps from file to file every time I compile eg. "vl53l0x_api_core.c", "vl53l0x_api_calibration.c", etc.
Reason why I must use the library provided by STM is because they did not release the I2C registers for this distance sensor, so I'm forced to use their library. I have tried referencing guides provided for VL53L1X but it didnt quite work.
You need to add the path where the header file is to the project. Right click on the project > properties > build > paths and symbols

Compiling SDL 2 alongside my own source files

Due to a compilation bug I cannot correctly use the SDL dynamically linked, I don't prefer to go with the static linking route as I'm not sure of how well implemented this is in the language I am using.
That's why I would like to compile the SDL 2 source files manually, I simply used the files present under /include and /src in the official repo, but at compile time I get this error:
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/video.c:23:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
^~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/keyboard.c:26:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
^~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/gl.c:23:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
^~~~~~~~~~~~~~~~~
1 error generated.
I know it is possible to do that since the official website mentions it, but I don't know at all what steps I should follow in order to make it work correctly?
EDIT :
Here is the sample repo: https://github.com/adtrevor/compileSDL
SDL is a cross-platform library, and its unlikely that you want to compile all of the source files in order to get the functionality that you need. Usually you run configure / make, and it will make the decisions on what to build/not build.
You mention that you are building the source files yourself; so you may want to obverse the SDL build and try to capture the same files. In regards to your error, QNX is the Blackberry operating system-- so depending on your use-cases you can avoid building everything under SDL/src/video/qnx/* since you don't have those operating system headers anyway.
SDL should build the static libraries by default anyhow. Consider doing a regular build and using sdl-config --static-libs to find out which static libraries you should link with.

Arduino IDE doesn't find sys/time.h in Windows

I'm trying to follow this tutorial to start testing my new Adafruit Azure IoT starter Kit that comes with an Arduino Feather M0 Wifi. I was able to setup the Arduino IDE 1.8.4 (From Windows Store) on my PC which is a Windows 10. In the step 1.8 (Build Your Remote Monitoring Sample), when I try to compile the solution "remote_monitoring.ino" dowonload from here, it appears the following error:
C:\iot-hub-c-m0wifi-getstartedkit-master\remote_monitoring\remote_monitoring.ino:12:22:
fatal error: sys/time.h: No such file or directory
#include <sys/time.h>
compilation terminated.
exit status 1 Error compiling for board Arduino/Genuino Uno.
It seems like in Windows, including sys/time.h just doesn't Works, but if I try to delete the sys/ part, it comes the following error:
C:\Users\jonguz\OneDrive -
Microsoft\Documents\Arduino\libraries\AzureIoTHub\src/sdk/serializer.h:42:19:
fatal error: cstdlib: No such file or directory
#include <cstdlib>
I appreciate your help.
sys/time.h and cstdlib are located in the toolchain used by the Adafruit SAMD Boards hardware package (specifically arm-none-eabi-gcc). The files in this tool are only added to the include search path when a board that uses that tool is selected in the Tools > Board menu. If you don't have one of those boards selected then the file will not be found, thus the error messages you encountered.
From https://learn.adafruit.com/adafruit-feather-m0-wifi-atwinc1500/using-with-arduino-ide:
Select the matching board, the current options are:
Feather M0 (for use with any Feather M0 other than the Express)
So the solution is to select Tools > Board > Adafruit Feather M0 after installing Adafruit SAMD Boards via Boards Manager but before compiling the sketch.
one can find a header-only Windows implementation of the <sys/time.h> header on GitHub here:
https://github.com/win32ports/sys_time_h
side note: RTC time implementations for the ESP32 can be found here:
https://github.com/kerikun11/ESP32Time
and here:
https://github.com/fbiego/ESP32Time

How to get opencv include work in kubuntu? (Includes solution to how to include and link in netbeans 6.7.1)

I have installed OpenCV C libraries from package management into my Kubuntu 9.10. I wrote a small image modification program that uses those libraries, but I can't compile it, because every time I try to compile I get the error message that the functions from OpenCV library cannot be found.
Those header files are in folder /usr/include/opencv/ but still the compiler says that functions cannot be found.
I have tried to include them by basic
#include <highgui.h>
#include <cv.h>
commands in netbeans (and I have set netbeans to search header files from that specific directory) and also tried to include them with full path.
#include </usr/include/opencv/highgui.h>
#include </usr/include/opencv/cv.h>
Also I tried to compile my source file in console (with full path includes), but again I got the same error message that the functions from those libraries cannot be found.
Edit:
The error message that I get is
undefined reference to 'function_name'
I get that error for every function that I try to use from that opencv library.
Any idea how to fix that problem?
Edit II:
in case someone else is using netbeans 6.7.1 and has the same problem, here's the solution copy pasted from another website:
Here I presume that you have succesfully installed the opencv library either manually or via package management.
Open Netbeans then do the following:
Select Tools -> Options -> C/C++ -> Code Assistance -> add Include Directories
(For me, /usr/local/include/opencv)
Create new project, then:
Right click on Project Name -> Properties ->Build -> C/C++ Compiler -> Include Directories
Include Directories : /usr/local/include/opencv
Right click on Project Name -> Properties -> Build -> linker ->
Include Directories : /usr/local/include/opencv
Additional Options : -I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml
Then writing program and compile!!
"undefined reference to" is a linker error. You forgot to link your application against the OpenCV libraries. Make sure you link against cv and highgui (-lcv -lhighgui) or use the pkg-config call that Tobu provided. I'd also second the request for more detailed error messages.
OpenCV uses pkg-config, the standard way to locate libraries and headers on unix. You can run (untested):
make CFLAGS="$(pkg-config --cflags --libs opencv)" your-program

Resources