Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 31
61  Using Arduino / Displays / Re: Library Size on: June 01, 2014, 01:04:21 pm
You could try the new AVR tool chain with GCC 4.8.1;!msg/developers/21G5w2HbUOg/bJtG94vEEhkJ

62  Development / Other Software Development / Re: Upload contributions in the Arduino libraries on: June 01, 2014, 09:34:03 am
Try posting your change here.!forum/developers
You should clone, do the change and issue a pull request. Follow that and I think you will get better attention. Your change is very small so that should not be a problem.  Cheers!
63  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 31, 2014, 06:03:20 pm
Check the CosaWirelessButton and the CosaWirelessReceiver example sketches. I think that will answer all your questions.

What might be confusing is that "outs.print(msg->payload, PAYLOAD_MAX);" prints the contents of the payload in hexadecimal notation. The payload does not contain the blanks. They are part of the formating.

Also the Wireless send/recv handle any data reference (void*) that is less or equal to the max payload size. The application can pass a string, struct, etc. Many of the example sketches pass struct's with binary data. The payload is not converted to and from strings (textual representation).

64  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 31, 2014, 05:46:22 pm
Two new Cosa example sketches that might be of interest:

1. TWI/10DOF
A new TWI example sketch demonstrates how to use a 10DOF module and display sensor readings on a LCD. The test setup is an Arduino Pro Micro with a GY-80 10DOF module, HD78440 (aka 1602) LCD with a GIICLCD TWI adapter running on a 1100 mAh 3.7V LiPo battery.

2. Ethernet/WebServer
The new Ethernet/Webserver example sketch demonstrates how to respond to HTTP GET requests by reading files from SD/FAT16 disks.

3. Pin Benchmark Statistics
Below is a link to the latest statistics for the Cosa Pin class benchmark (CosaBenchmarkPins.ino) for the old and new AVR toolchain.

4. Updated Ethernet/WebServer with Pin status.
More dynamic HTML generation for the CosaPinWebServer example sketch. Generates table with digital pin state and chart with analog pin reading (scaled 0..99).

65  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 31, 2014, 05:23:00 pm
I spent some time understanding the packet being sent, what I want to do is print out the NR value and a member of the payloads value on an lcd screen. I've managed to run the example code, and it outputs these values to the Uart trace fine. What I'm wondering is how to take some of these values and concert them to integers so I can either store them or print them to the lcd screen. I'm using the payload type of message and am having trouble getting the NR member's value into an integer.

Thanks a lot for this project there is a lot of interesting stuff in here. Sorry I'm pretty green when it comes to coding.
You are welcome!

There are a number of examples of how to use the Cosa LCD. If you can print to the UART you can do the same with the LCD. They are both IOStream::Device's and you can simply bind trace to the LCD.

The rest of your questions are difficult to understand without some code. You must understand the basic data types in C/C++ and how to convert between textual and binary representations. Most of the necessary conversions are done by the IOStream class.

66  International / Scandinavia / Re: Hur får jag en billig RF 433 MHZ modul att sända när jag aktiverar en knapp? on: May 31, 2014, 09:50:31 am
Kanske mer än du behöver? Nedan "skiss" använder näst intill ingen ström i väntan på att man trycker på en knapp. Vid knapptryckning läser den två analoga värden och skickar som meddelande tillsammans med tidsmärke och batteristatus. Kan konfigureras för att använda CC1101, NRF24L01P, RF433 eller RFM69. Kan köras på de flesta Arduino men också ATtiny. Skrivet i Cosa.

67  Development / Other Hardware Development / Re: Multi ATtiny programmer on: May 30, 2014, 02:46:09 pm
I use a simpler solution; a 40 pin ZIF socket, upper end for AttinyX5 and lower end for AttinyX4. See
NB. The blog shows the early design with only AttinyX5. Since then I have added support for AttinyX4.

68  Using Arduino / Installation & Troubleshooting / Re: Help with Cosa Installation on: May 28, 2014, 02:30:09 am
Cosa should be really simple to install and get running. Sorry to hear that you are having problems with that. Could you please provide some more information?

1. What version of the Arduino IDE are you using?
The support for 1.0.X was deprecated a few weeks back as the development focused on 1.5.X and the new AVR toolchain BUT as there has been a number of requests for keeping the 1.0.X support it now available again (See If you are using 1.0.X please download Cosa from github and install again.

2. What Arduino board are you using?
You MUST select a Cosa prefixed board in the IDE Tools>Board menu. This is how the Cosa core is selected. The Cosa example sketches do not compile with the Arduino core.

Please note that Cosa is not an Arduino(TM) product. Support requests should be posted on the Cosa github issue list. This will give you the best and quickest response.

69  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 27, 2014, 04:37:52 am
Some news on the latest Cosa updates:

1. Restored support for Arduino IDE 1.0.X
The Arduino 1.0.X IDE support was deprecated but has been restored after some requests.

2. Ethernet Shield example sketch robustness
The SD and W5100 device on the Ethernet Shield may interfere each other if not correctly disabled. The Ethernet example sketches have been updated to avoid the interference and improve robustness.

3.  More program memory free space on Leonard/Micro/Lilypad-USB (ATmega32U4)
The USB/CDC functionality is only added when needed. This allows larger sketches on ATmega32U4 devices. Compiling an empty sketch with Arduino/Wiring (1.5.6) gives:
Sketch uses 3,976 bytes (13%) of program storage space. Maximum is 28,672 bytes.
Global variables use 158 bytes (6%) of dynamic memory, leaving 2,402 bytes for local variables. Maximum is 2,560 bytes.
The latest Cosa update gives:
Sketch uses 290 bytes (1%) of program storage space. Maximum is 28,672 bytes.
Global variables use 0 bytes (0%) of dynamic memory, leaving 2,560 bytes for local variables. Maximum is 2,560 bytes.

4. LCD IO Adapter abstraction for PCD8544 and ST7565
The HD78440 LCD (1602/2004) IO Adapter abstraction is now implemented for the PCD8544 and ST7565. The two adapters are 1) serial output pin (Serial3W) and 2) SPI output (SPI3W).
Interface (LCD::IO):

5. Pin Benchmarks
The Cosa Pin classes have been further optimized and there are a set of new benchmark run files.
a. Arduino 1.0.5/1.5.6-r2 toolchain
b. Arduino Nightly build with new AVR toolchain (GCC 4.8.1)
c. Arduino Nightly build with new AVR toolchain (GCC 4.8.1) with link-time-optimization

6. Improved HTTP::Server response io-stream handling
The support for writing simple HTTP servers has been improved with IOStream binding and parsing path, query and request type.

7. Completed support for Teensy 2.0/Teensy++ 2.0

70  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 18, 2014, 03:25:26 pm
Some news on the latest Cosa updates:

1. Improving Shift-Register Parallel output class (SRPO<N>)
Improving the SPI device driver for cascaded 74HC595 shift registers (previously SR3W); a very fast port expander. Includes a new internal class, SRPO<N>::OutputPin, which acts as a Cosa OutputPin (same interface but cannot replace).
Interface (and source):
Below is a snippet from the example sketch.
 * @file CosaSRPO.ino
 * @version 1.0
 * ...
 * @section Description
 * Demonstrate Cosa N-Shift Register (SRPO) SPI device driver and Low
 * Power handling. Cascade two shift register (74HC595) and connect
 * LEDs. Circuit below shows ATtinyX5 and 2 X 74HC595 schematics.
 * @section Circuit
 *                         ATinyX5  
 *                       +----U----+
 * (/RESET)------------1-|PB5   VCC|-8------------(VCC)
 * (D3/A3)--------+----2-|PB3   PB2|-7---------(D2/SCK)----+
 *                |    3-|PB4   PB1|-6--------(D1/MOSI)--+ |
 * (GND)----------(----4-|GND   PB0|-5                   | |
 *                |      +---------+                     | |
 *                +--------------------------------------(-(-+
 *                                                       | | |
 *                         74HC595    (VCC)              | | |
 *                       +----U----+    |                | | |
 * (LCD1/GREEN)--------1-|Q1    VCC|-16-+                | | |
 * (LCD1/BLUE)---------2-|Q2     Q0|-15------(LCD1/RED)  | | |
 *                     3-|Q3    SER|-14---(MOSI/D11/D1)--+ | |
 *                     4-|Q4    /OE|-13-----------(GND)    | |
 *                     5-|Q5   RCLK|-12-----(EN/D10/D3)----(-+
 *                     6-|Q6   SCLK|-11----(SCK/D13/D2)----+ |
 *                     7-|Q7    /MR|-10-----------(VCC)    | |
 *                   +-8-|GND   Q7S|--9------------------+ | |
 *                   |   +---------+                     | | |
 *                   |      0.1uF                        | | |
 *                 (GND)-----||-------(VCC)              | | |
 *                                      |                | | |
 *                         74HC595      |                | | |
 *                       +----U----+    |                | | |
 * (LCD2/GREEN)--------1-|Q1    VCC|-16-+                | | |
 * (LCD2/BLUE)---------2-|Q2     Q0|-15------(LCD2/RED)  | | |
 *                     3-|Q3    SER|-14------------------+ | |
 *                     4-|Q4    /OE|-13-----------(GND)    | |
 *                     5-|Q5   RCLK|-12--------------------(-+
 *                     6-|Q6   SCLK|-11--------------------+
 *                     7-|Q7    /MR|-10-----------(VCC)
 *                   +-8-|GND   Q7S|--9
 *                   |   +---------+  
 *                   |      0.1uF      
 *                 (GND)-----||-------(VCC)
 * This file is part of the Arduino Che Cosa project.

#include "Cosa/Power.hh"
#include "Cosa/Watchdog.hh"
#include "Cosa/SPI/Driver/SRPO.hh"

// Power-down delay
#define POWERDOWN_DELAY(ms) \
  do { \
    uint8_t mode = Power::set(SLEEP_MODE_PWR_DOWN); \
    Power::all_disable(); \
    delay(ms); \
    Power::all_enable(); \
    Power::set(mode); \
  } while (0)

// Two cascaded shift registers; use D10/D3 as chip select pin,
// MOSI for serial data and SCK for clock.
SRPO<2> port;

void setup()
  // Setup the watchdog; use power-down period as wakeup time

  // Blink the blue leds; local pin variable
  SRPO<2>::OutputPin blue1(&port, 2);
  SRPO<2>::OutputPin blue2(&port, 10);
  for (uint8_t i = 0; i < 10; i++) {

void loop()
  // Cycle through the shift-register parallel output pins (0..15)
  static uint8_t pin = 0;

  // Set pin and update shift register

  // Clear pin and update shift register

  // Step to the next pin (0..15)
  pin = (pin + 1) & 0xf;

2. Support for MIDI Note numbers
Calculate MIDI note number frequency.

3. Pin/Port Scanner
The Cosa example library contains a number of tools; TWI and OWI scanners. A new  tool for scanning pin/ports has been added.

4. Improved documentation
List of supported boards and MCUs with links to board definitions and layout.

5. Improved Analog pin class
Reduce SRAM footprint for Cosa AnalogPin instances; 12 => 9 bytes.  

71  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 12, 2014, 02:52:07 pm
Some news on the latest Cosa updates:

1. Support for Teensy 2.0 and Teensy++ 2.0
Board definition: and IDE/build settings Part of the Cosa boards.txt file;
Compile Cosa sketches with the Arduino IDE and use the Teensy Loader

2. Tone and Notes
Port of toneAC ( to Cosa. Refactoring to a more object-oriented version and extended with a support class for notes;  
Interface: and

3. Refactoring Cosa board definition structure to allow multiple vendors/clones
See and Each board description contains an ASCII pin layout schematics. Below are some examples.
The documentation of the port-pin mapping to enum data types is improved.

4. Support for Arduino Yún
Lately there has been some requests for support for Cosa on Yún. This would require implementing the Yún WiFi/ATmega32U4 bridge protocol in Cosa and wrapping that in the Cosa Socket and INET interfaces. See discussion on blog;

72  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 03, 2014, 07:26:30 pm

Typically if the Cosa header files are not found you might have forgot to select one of the "Cosa Boards". With Arduino 1.0.X you do not need the extra "avr" level in the hardware folder.

I work mainly on Linux (Ubuntu) with Emacs as editor and the Arduino IDE for build, download and serial monitor. My brother works on the other hand on Mac OSX and has recently put together a pre-packaged release of Cosa on github;

There is excellent install support in embedXcode.

73  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 03, 2014, 03:09:20 pm
Some news on the latest Cosa updates:

1. SR3W
New three wire SPI device driver that supports cascaded shift registers. Uses MOSI, SCK and CS.

2. Faster SPI block transfer
Two new SPI member functions (transfer_start/await) to allow faster SPI transactions with interleaving of SPI transfer and processing (e.g. fetch next data element, calculate check sum, etc).

3. SD/FAT16 performance improvement
Using the new SPI member functions to improve the SD and FAT16 performance. Example below:

4. Documentation
Circuit descriptions added to source code documentation. Some examples:

74  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: April 29, 2014, 01:29:12 pm
A short update on introducing AVR Toolchain with GCC 4.8.1 and using link time optimization. Below are build statistics for some of the Cosa example sketches (Arduino UNO, program storage space/dynamic memory). Left column for Arduino 1.5.6 ( and the right column Arduino Nightly Build with GCC 4.8.1 (!msg/developers/21G5w2HbUOg/-aH8wQJP6x8J).
                    1.5.6-r2     4.8.1+lto
Empty Sketch         210/0        154/0
CosaBenchmarkPins    18010/420    13402/451
CosaBlink            1060/21      904/18
CosaBlinkMinimal     266/2        194/0  
CosaCanvasST7735     19790/600    17120/629
CosaSNMP             20936/662    17456/697
CosaMQTThumidity     17528/575    15072/674
CosaThingSpeakClient 23452/989    20884/1046
CosaHD44780          5662/149     4964/196

This gives an idea of the program size reduction. There is also an improvement in performance.

75  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: April 27, 2014, 03:05:43 pm
WOW! I am glad I found Cosa!
A huge amount of quality work in those libraries.
Thanks for your interest in Cosa. Please feel free to use the github issue list for suggestions, improvements, bugs, etc.

On the issues list you can also find what I am working on right now (items marked backlog). The latest focus has been on 1) improving documentation and coding style to further enhance using embedXcode. and 2) adapting for the new avr toolchain (gcc 4.8.1).

Cosa has its own platform.txt file with compiler and tools options. The build enables all warnings from the compiler (-Wall and -Wextra). This is to improve code quality and get as much support from the compiler as possible. The goal is to keep Cosa "compiler warning clean" at all time.

With the latest update the Cosa build uses link time optimization (-flto). Together with some improvements the Pin classes are now even faster with Output::toggle() as fast as 62 ns (@ 16 Mhz). Details from the benchmarking can be found in the benchmark sketches;, and for the Pins classes;

Pages: 1 ... 3 4 [5] 6 7 ... 31