Another Class where method calls show the "does not name a type" problem
hello,
i'm quite new arduino , programming in general. problem quite strange, since seems others don't have problem particular class. class im talking sendonlysoftwareserial. downloaded class multiwii project website , tried use in own project, somehow isn't recognized aruino ide (linux, v1.0.5). created test project, , stripped class bare minimum, problem remains. below 3 files in 'test' directory:
sendonlysoftwareserial.h
sendonlysoftwareserial.cpp
test.ino
this results in:
error compiling.
test.ino:7:1: error: 'sserial' not name type
the same error comes, if try call public 'write' method of class, doesn't come call constructor (which call private 'settx' method). there obvious i'm missing here?
i'd appreciate help... tia, juhis
i'm quite new arduino , programming in general. problem quite strange, since seems others don't have problem particular class. class im talking sendonlysoftwareserial. downloaded class multiwii project website , tried use in own project, somehow isn't recognized aruino ide (linux, v1.0.5). created test project, , stripped class bare minimum, problem remains. below 3 files in 'test' directory:
sendonlysoftwareserial.h
code: [select]
#ifndef sendonlysoftwareserial_h
#define sendonlysoftwareserial_h
#include "arduino.h"
#include <inttypes.h>
#include <stream.h>
class sendonlysoftwareserial : public stream
{
private:
uint16_t _tx_delay;
uint16_t _inverse_logic;
uint16_t _errors_ok;
// private methods
void settx(uint8_t transmitpin);
public:
// public methods
sendonlysoftwareserial(uint8_t transmitpin, bool inverse_logic = false, bool errors_ok = false);
~sendonlysoftwareserial();
void begin(long speed);
void end();
int peek();
size_t write(uint8_t b);
virtual int read();
virtual int available();
virtual void flush();
};
#endif // sendonlysoftwareserial_h
sendonlysoftwareserial.cpp
code: [select]
#include <stream.h>
#include <avr/pgmspace.h>
#include "sendonlysoftwareserial.h"
sendonlysoftwareserial::sendonlysoftwareserial(uint8_t transmitpin, bool inverse_logic /* = false */, bool errors_ok /* = false */) :
_tx_delay(0),
_inverse_logic(inverse_logic),
_errors_ok(errors_ok)
{
settx(transmitpin);
}
sendonlysoftwareserial::~sendonlysoftwareserial()
{
end();
}
void sendonlysoftwareserial::settx(uint8_t tx)
{
pinmode(tx, output);
digitalwrite(tx, high);
}
void sendonlysoftwareserial::begin(long speed)
{
_tx_delay = 200;
}
void sendonlysoftwareserial::end()
{
}
size_t sendonlysoftwareserial::write(uint8_t b)
{
return 0;
}
int sendonlysoftwareserial::available()
{
return 0;
}
int sendonlysoftwareserial::read()
{
return -1;
}
void sendonlysoftwareserial::flush()
{
return;
}
int sendonlysoftwareserial::peek()
{
return -1;
}
test.ino
code: [select]
#include "sendonlysoftwareserial.h"
#define telemetry_frsky_softserial_pin 2
sendonlysoftwareserial sserial(telemetry_frsky_softserial_pin, true, true);
sserial.begin(9600);
this results in:
error compiling.
test.ino:7:1: error: 'sserial' not name type
the same error comes, if try call public 'write' method of class, doesn't come call constructor (which call private 'settx' method). there obvious i'm missing here?
i'd appreciate help... tia, juhis
is test.ino file of sketch? sserial.begin() method call, , cam not happen outside of function.
Arduino Forum > Using Arduino > Programming Questions > Another Class where method calls show the "does not name a type" problem
arduino
Comments
Post a Comment