Cosa: An Object-Oriented Platform for Arduino programming

Cosa build support and benchmark results for Arduino 1.6.0 are now available. Please see latest commit.

Cheers!

I can't find the ICMP protocol being implemented in Cosa. Any suggestions on where to start if I should implement that protocol in order to write a ping function so I can ping a given IP adress.

@sehlstrom

Thanks for your interest in the Cosa project. Please file this as an issue on github. Do not forget to add a motivation and what devices that should be supported. I guess that you are considering the W5100 and Ethernet Shield?

BW: Am I correct in assuming that you are requesting support on how to write a ping function for the above device? In that case I must inform that I do not give support without commitment on contributing to the project.

Cheers!

Issue filed!

I will gladly contribute as much as I can.

/Alex

The latest update of the Cosa project includes;

  1. Support for ITEAD Studio IBoard
    Initial support for the IBoard with Ethernet Controller (W5100), SD card, XBee and NRF24L01P.

  2. ICMP
    Support for ping (echo request) from sketch/board to other network address. For further details see interface and example sketch.

  3. INET checksum
    Internet protocol checksum calculation (header, etc).

  4. Soft SPI
    Updated Soft SPI class to align with SPI interface and functions.

The latest update of the Cosa project includes;

  1. Hamming (8,4) and (7,4) Codec for the VWI (Virtual Wire Interface) implementation of the Cosa Wireless Interface.
    The new codec is constructed to give good DC balance with error correction. The codec will detect up to 2-bit errors (in 4-bit data) and automatically correct 1-bit errors. This reduces RF433 modules frame error rate from 1-5% down to less than 1% (typical 0.1-0.3%). The coding and decoding are table driven and requires less than 150 bytes program memory (8,4) and 80 bytes for (7,4).

  2. Major refactoring of member functions with program memory string parameters.
    The new string data type (str_P) introduced with the String class allows overloading and the _P suffix may be dropped on a number of member functions. The type "const char*" is used for literal strings in the new compiler.

  3. Update to the UML runtime.
    a. Renaming of Sensor to Voltmeter.
    b. Added a Thermometer Capsule for DS18B20. This allows simple periodic reading of DS18B20. See example sketch.
    c. Display Capsule to probe signal directly to an LCD. See the Thermometer example sketch.
    d. Performance improvement of the Capsule scheduling.
    e. New Relay Capsule.

  4. Improved Math functions.

Cheers!

A short update on the latest development in the Cosa project.

  1. Support for Arduino 1.6.1
    The Windows version of Arduino 1.6.1 does not include the GCC linker plugin for Link-Time-Optimization (LTO). A platform.txt file is available without GCC LTO enabled as an intermediate solution.

  2. Improved fuse setting for breadboard variants (ATtinyXX).
    An updated avrdude configuration file is available to correct ATtiny85 fuse verification. Dummy bootloader files are also included (e.g. blink sketch).

  3. DHT11/22 device driver update.
    The event driven variant has been removed to reduce footprint. A example sketch for ATtiny85 with RF433/VWI/Hamming Code (7,4) and DHT11 is available.

  4. Cosa SPI demo sketch.
    A new SPI example sketch is available to demonstrate the design pattern and how it handles multiple access, timing, etc.

The channels in the logic analyzer are; 0) data (MOSI), 1) clock (SCK), 2) chip select device 1 (active low), 3) chip select device 2 (active high), 4) chip select device 3 (pulse low), 5) chip select device 4 (pulse high), and 6) transaction markers. Typical device that uses the chip select pulse high is SPI based LCD adapters such as SR3WSPI.

  1. Improved command handling.
    The Cosa command line build utility has been improved for serial monitoring with ATmega32U4 devices (USB, e.g. Leonardo, Pro-Micro).

Cheers!

Celebrate the Arduino Day with a free download of the OOP platform for Arduino on AVR. Doxygen generated documentation is available online. And you are up and running in only a few minutes. Here is how you install.

Cheers!

Arduino 1.6.3 is now supported. The work around for Windows and link-time-optimization (LTO) is not necessary any more with the new gcc-avr packaging.

Cosa will use its own avrdude configuration file to avoid warnings with breadboard variants (e.g. ATtiny).

Cheers!

I am not able to get Cosa compiling, I get the following error:

collect2.exe: fatal error: CreateProcess: No such file or directory

Removing -flto from the compiler.c.elf.extra_flags in platform.txt solves the problem.

Arduino IDE 1.6.4
Latest build of Cosa downloaded a minute ago (should support Arduino 1.6.4)
Windows 7

@zman22

Thanks for the info and your effort locating the problem with the Arduino IDE 1.6.4 and LTO. The AVR GCC LTO plugin seems to be missing (again).

There is an update with LTO removed/disable for the Ardunio IDE (as above). The Cosa command line build will still use LTO.

Please see issue for further details.

Cheers!

With the improvements in library and board handling it is now time to restructure Cosa into a much smaller core and a larger set of libraries. The advantage is that first time build times are greatly reduced for small sketches that do not use as much of the Cosa class library.

Please see GitHub - mikaelpatel/Cosa: An Object-Oriented Platform for Arduino/AVR for more details.

Cheers!

Thanks for your quick action.

I just came across this library and it looks great. I am having trouble blinking the LEDs on pins 40-45 (the only ones I tried) on Aruduino Mega 2560 using the library. I can blink the built-led (on pin 13), just fine.

There's no problem with the hardware as the program using simple Arduino code runs fine.

Here's the sketch.

#include "Cosa/OutputPin.hh"

OutputPin pin0 (Board::DigitalPin::D13); // works

OutputPin apLED (Board::DigitalPin::D40);
OutputPin atLED (Board::DigitalPin::D41);
OutputPin lnavLED (Board::DigitalPin::D42);
OutputPin vnavLED (Board::DigitalPin::D43);
OutputPin hdgHoldLED (Board::DigitalPin::D44);

void setup() {
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:

apLED.toggle ();
atLED.toggle ();
lnavLED.toggle ();
vnavLED.toggle ();
hdgHoldLED.toggle ();

pin0.toggle ();

delay (1000);

}

do you need
pinMode(apLED, OUTPUT);
with this
OutputPin apLED (Board::DigitalPin::D40);
?

It is declared as OutputPin. I expect the constructor to set it up that way. Besides, I don't think I can access arduino commands (e.g. pinMode) when I change the board to Cosa....
Also as I mentioned, LED on pin 13 blinks fine.

@nitinsane

Have you connected the LEDs correctly? Each should be in serial with a resistor (typical 300-500 ohm) to GND.

Cheers!

@Kowalski,

Yes, code written using normal Arduino commands (pinMode, digitalWrite, etc) works perfectly. I am trying to port that code to use the Cosa library.

Please find the first tagged release of Cosa available at github, v1.0.0

This is the result of a major refactoring into a smaller set of core classes and a large number of libraries with example sketches. The refactoring gives a great improvement in build time when using the Arduino IDE.

Cheers!

The latest update in the Cosa project focuses on refactoring the core to reduce build time and improve structure (architecture). Some of the Cosa libraries have be moved to separate github repositories.

  1. MQTT
  2. ThingSpeak
  3. Google ProtocolBuffers
  4. UML Capsules and Connectors

Additional high level libraries and some device drivers will also be moved to separate repositories. This is an early release to allow comments and feedback.

Cheers!