hi there everybody
i'm new to the Arduino world and I think i am missing some basical stuff to make things working well..
I used to code a lot in c/c++,java etc, now in Arduino I have some problems with the language and the coding standards..
I am trying to write a simple library for an Arduino UNO using Arduino IDE 1.0.1 on windows 7 x64.
serial2.cpp:4: error: 'SoftwareSerial' does not name a type
I used SoftwareSerial in another skech and it worked well, but i cannot figure out why in this library is not recognized.
Am I writing the library in a wrong way?
Thanks everybody
You are trying to hide the use of a library from the sketch. You can not do that. You must do what everyone else does, and tell the sketch that you are using SoftwareSerial, but #including it's header file.
thanks for the reply, so i have to specifically include the library also in the main file?
I modified the files in this way, but i'm still getting the same error
Your header file references the SoftwareSerial class. You need to #include SoftwareSerial.h in your header file, not in your source file.
Then. you will have other errors. The private member Serial_2 is defined AND INITIALIZED in the header. That is not allowed. You need to define it, only:
SoftwareSerial Serial_2;
Then, in the source file, you need to initialize it: