I am trying to get the NFC shield working using SPI communication.
I did follow all the instructions exactly as explained in
Seeed Wiki - NFC Shield Setup.
Here is the code I tried:
#include <SPI.h>
#include <PN532/PN532_SPI/PN532_SPI.h>
PN532_SPI pn532spi(SPI, 10);
NfcAdapter nfc = NfcAdapter(pn532spi);
void setup(void) {
Serial.begin(115200); // begin serial communication
Serial.println("NDEF Reader");
nfc.begin(); // begin NFC communication
}
void loop(void) {
Serial.println("\nScan an NFC tag\n");
if (nfc.tagPresent()) // Do an NFC scan to see if an NFC tag is present
{
NfcTag tag = nfc.read(); // read the NFC tag into an object, nfc.read() returns an NfcTag object.
tag.print(); // prints the NFC tags type, UID, and NDEF message (if available)
}
delay(500); // wait half a second (500ms) before scanning again (you may increment or decrement the wait time)
}
Here is the error I am getting.
ResolveLibrary(PN532/PN532/PN532Interface.h)
In file included from D:\Dropbox\Ardruino\Seed NFC Reader\Seeed\ReadTagWithSPI
\ReadTagWithSPI.ino:9:0:
-> candidates: []
C:\Program Files (x86)\Arduino\libraries\Seeed_Arduino_NFC-master
\src/PN532/PN532_I2C/PN532_I2C.h:9:10: fatal error: PN532/PN532/PN532Interface.h: No such file
or directory
#include "PN532/PN532/PN532Interface.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
\libraries\SPI
Using library PN532_SPI in folder: C:\Program Files (x86)\Arduino\libraries\PN532_SPI (legacy)
Using library Seeed_Arduino_NFC-master at version 1.1.0 in folder: C:\Program Files
(x86)\Arduino\libraries\Seeed_Arduino_NFC-master
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino
\avr\libraries\Wire
exit status 1
Error compiling for board Arduino Uno.
If you are using ArduinoIDE use Sketch -> Manage Libraries ->Library Manager
Enter PN532 in the search field and install the lib Adafruit PN532 from there.
This ensures its placed in the right directory. Probably your libs are in a different thanin the Afafruit example.
Related
I wrote this code:
#include <Keyboard.h>
void setup() {
Keyboard.begin();
Keyboard.print("Hello!");
}
And Iam getting the error
C:\Users\nobody\sketch_feb12a\sketch_feb12a.ino: In function 'void setup()':
C:\Users\nobody\sketch_feb12a\sketch_feb12a.ino:4:3: error: 'Keyboard' was not declared in this scope
Keyboard.begin();
^~~~~~~~
exit status 1
Compilation error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
I tried installing Keyboard.h from a zip and from the Library manager.
What do I have to change?
If you're trying this on a board that supports emulating USB devices, such as the Teensy, then you need to select keyboard option for USB Type:
Tools > USB Type > Keyboard
This library does not work for the Arduino Uno or similar boards.
Have you use the board like Leonardo? If you try to compile code with keyboard for the board which doesn't support HID interface, you will get this error.
While compiling my rather simple project I get an error that I'm unable to resolve. The included libraries are:
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>
And the error that HTTP_GET was not declared in this scope concerns the following line :
message += (server.method() == HTTP_GET) ? "GET" : "POST";
I'm using an ESP32 module produced by AZDelivery, the board is selected and other simple projects (like blinking the internal LED) word like a charm.
Any ideas how to solve this would be appreciated
EDIT: below is the full error message as thrown in Arduino IDE (on macos)
Users/yannickgery/Documents/Arduino/controlservo/controlservo.ino: In function 'void handleNotFound()':
controlservo:156:34: error: 'HTTP_GET' was not declared in this scope
message += (server.method() == HTTP_GET) ? "GET" : "POST";
^
/Users/yannickgery/Documents/Arduino/controlservo/controlservo.ino: In function 'void setup()':
controlservo:206:23: error: 'HTTP_GET' was not declared in this scope
server.on("/motor", HTTP_GET, motorControl);
^
Multiple libraries were found for "WiFi.h"
Used: /Users/yannickgery/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
'HTTP_GET' was not declared in this scope
Assuming you're using the HTTP methods defined in this arduino-esp32 library then perhaps you have a very old version of it? Try including this file directly with #include "HTTP_Method.h", see if it surfaces #include errors (in which case you have a very old version) or fixes your problem (maybe you have several files of the same name in the include path?).
I am developing with VisualStudio Code and Platform.IO installed.
I am using ESP32 / TTGO T-CALL with Arduino Framework and added the RTCLib.h Adafruit v 1.11.0
Unfortunately the software is not compiling because I got the following error:
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Compiling .pio\build\esp32dev\libfa0\TinyWireM\USI_TWI_Master.cpp.o
C:\Users\aleil\.platformio\lib\TinyWireM\USI_TWI_Master.cpp:28:27: fatal error: avr/interrupt.h: No such file or directory
compilation terminated.
Archiving .pio\build\esp32dev\lib46d\libRTClib.a
*** [.pio\build\esp32dev\libfa0\TinyWireM\USI_TWI_Master.cpp.o] Error 1
============================================ [FAILED] Took 8.69 seconds ============================================
The terminal process "C:\Users\aleil\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Here there is the INCLUDING code:
#include <Arduino.h>
#include <StreamDebugger.h>
#include <ArduinoHttpClient.h>
#include <ArduinoJson.h>
#include <OneWire.h> // x ds18b20 temperature sensors
#include <DallasTemperature.h> // x ds18b20 temperature sensors
#include <esp_task_wdt.h>
#include "SPI.h" // Used to define SPI on SPI1
#include "SD.h"
#include <Wire.h>
#include <RTClib.h>
So I try to find a solution but I cannot find one. Does someone have some hint or solutions?
I had the same problem, but uninstalling the TinyWireM library (PlatformIO > Libraries > Installed) solved the problem.
I think the TinyWireM library is installed automatically with the RTClib library.
I'm trying to test a library for an DHT22 "Temperature Sensor", but I got an error while including an internal arduino library from the DHT.cpp file
I got this error:
C:\Program Files (x86)\Arduino\libraries\DHT\DHT22.cpp:56:20:
fatal error: avr/io.h: No such file or directory #include <avr/io.h>
In the DHT22.cpp, this is the the block of error
extern "C" {
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
}
I got in the conclusion that the library is not finding the avr folder which is
in C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr I checked another built-in library servo.cpp and this is the include part
#include <avr/interrupt.h>
#include <Arduino.h>
but the last one works without errors, my question is why the DHT library is not importing the required files and the servo does ?
It looks like you are using some old version of the library (from 2012).
The latest version, which does not contain the problematic "extern" block, can be found here:
https://github.com/adafruit/DHT-sensor-library
(The default example works nicely with my Arduino Nano v3.0 and DHT22 sensor)
I'm trying to install the SDL library for Qt 5.1 on Windows 7, but I'm stuck. I'm a total newbie with using external libraries so please bear with me, I figured this sort of thing would be pretty basic to set up.
I downloaded the SDL-devel-1.2.15-mingw32.tar.gz (Mingw32) file, extracted it, and in my project's PRO file I added:
INCLUDEPATH += "C:\SDL\SDL-1.2.15\include\SDL"
LIBS += "C:\SDL\SDL-1.2.15\bin\SDL.dll"
Now when I try to compile this:
#include <iostream>
#include <stdlib.h>
#include "SDL.h"
using namespace std;
int main()
{
SDL_Init( SDL_INIT_EVERYTHING );
cout << "Hello World!" << endl;
return 0;
}
I get this:
crt0_c.c:-1: error: undefined reference to `WinMain#16'
collect2.exe:-1: error: error: ld returned 1 exit status
Compiling with SDL and g++ cannot find -lSDLmain etc
Undefined reference to WinMain#16 when using SDL
I am sure one of those is also applicable to your question.
SDL should be prevented from overloading main method. To do so, add the following piece of code wherever you include SDL headers.
#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#ifdef __MINGW32__
#undef main /* Prevents SDL from overriding main() */
#endif
To make it working in your case, your project.pro file should be like this:
LIBS += -LC:\SDL-devel-1.2.15-mingw32\SDL-1.2.15\lib -llibSDL
INCLUDEPATH +=C:\SDL-devel-1.2.15-mingw32\SDL-1.2.15\include
As it is eveident from my code, I am using sdl version 1.2.15, 32-bit for mingw compiler on Windows 8.
Reference:
To find a good tutorial about the SDL ffmpeg integration, you can refer to dranger.