@englund
Sorry for the delay.
I looked into your first post again and I think that you have got Cosa installed correctly to allow mixing Arduino and Cosa code. What I need to figure out and understand is what your sketch is including and if you have organized your code with additional class files in your sketch folder.
Best thing to do is to track down compiler errors. Let us first step back to the install procedure just to verify. As I mentioned Cosa is now an Arduino core and much easier to install. The drawback is that Arduino/Wiring functions will not be available (in this installation variant). The work-around is to install as you already have done. That is, from the unzipped Cosa folder move the cores/cosa/Cosa folder to the arduino/hardware/arduino/cores/arduino folder.
If you move the examples folder from the Cosa unzipped folder to your Sketch book they will become available and you can verify that you can build the Cosa example sketches. I am assuming you are using Windows. If you are using Linux replace the moving of folders with symbolic links to the directories instead.
Now back to your compiler errors. To go further on this you will have to post or send me a copy of the include section of your sketch. This will give a hint on how to work-around the conflicting symbols. Even better is to locate the pre-processed file (ino => cpp file) as it contains all the symbol definitions.
I think we need to seek the symbol conflict in your sketch or the libraries. What I can see of Arduino.h and pins_arduino.h there is no problems there.
Below is a semi-port of one of the NEXA example sketches. Instead of using the Cosa OutputPin member functions to toggle a LED on receiving a NEXA remote command the Arduino/Wiring digitalWrite() function is used.
#include "Cosa/Pins.hh"
#include "Cosa/Event.hh"
#include "Cosa/Driver/NEXA.hh"
#include "Cosa/RTC.hh"
#include "Cosa/Watchdog.hh"
class LED : public NEXA::Receiver::Device {
private:
uint8_t m_pin;
public:
LED(uint8_t pin) : NEXA::Receiver::Device(0L), m_pin(pin)
{
pinMode(m_pin, OUTPUT);
}
virtual void on_event(uint8_t type, uint16_t value)
{
digitalWrite(m_pin, value);
}
};
NEXA::Receiver receiver(Board::EXT0);
LED device(LED_BUILTIN);
void setup()
{
RTC::begin();
Watchdog::begin();
NEXA::code_t cmd;
receiver.recv(cmd);
device.set_key(cmd);
receiver.attach(&device);
receiver.enable();
}
void loop()
{
Event event;
Event::queue.await(&event);
event.dispatch();
}
This compiles nicely in Arduino 1.0.5. Short on how the sketch works;
- Connect a RF433 receiver module to EXT0 (that is Arduino pin D2).
- Upload the sketch to your Arduino.
- Use a NEXA remote. The address of the first code sent will be used as the address for the Arduino NEXA receiver.
- After that pushing ON and OFF will turn the built-in LED on and off.
A modification is to add the serial device and print the received command code. And then hardwire it in the sketch. The next step is obviously to add a learning mode where the received code/address is stored in EEPROM.
Cheers!