sketch size

On my Uno/Leonardo/Mini/Micro etc my sketches usually do something like this:

while(true) {





}

None of these steps is blocking or computationally expensive so the loop executes them all very quickly giving instant response to user interface (buttons and display). But the sketches usually reach the limits of sketch size.

With the Yun, the sketch size is limited to ~28k and just including process.h takes 32% of that, leaving just over 19k for sketches. So most the stuff needs to happen on the Linino side. But now I'm worried about the time it takes to communicate back and forth between arduino and linino.

Are there any general guidelines or words of wisdom about how to partition the software between arduino and linino ?

Please use code tag.

Jantje:
...
I have a sketch which would fit on the yun but doesn't because the bootloader takes 4k of the available 32K (that is more than 12%)
...
Jantje

http://forum.arduino.cc/index.php?topic=209587.msg1542895#msg1542895

flash sketch only ( save 12% flash memory)

/usr/bin/run-avrdude    /tmp/Blink.cpp.hex

The sub perfect memory consumption was one reason why I stopped using Bridge and established a Serial1 based communication with my python script on Linino.

Can you share how to do that please?

Sure.
Arduino Sketch would look like this:

void setup() {
  Serial1.begin(115200);  
}
void loop() {
  if (Serial1.available() > 0) {
    char c = Serial1.read();    // read from Linino

...
  char buffer[120];
  sprintf(buffer, "response=%s[[%d,%d],[%d,%d],[%d,%d],[%d,%d],[%d,%d],%d]", cmd,
          stageCycles, stageVoltage, stageCycles, stageVoltage, stageCycles, stageVoltage, stageCycles, stageVoltage, stageCycles, stageVoltage, boilerSensorTarget);

Serial1.println(buffer);
}

And the Linino python script this way:

import serial

ser = serial.Serial('/dev/ttyATH0', 115200)
...
                # handle message comming from Arduino
                while ('\n' not in message):
                    message += ser.read(ser.inWaiting() or 1) #read all char in buffer                 
                print (str(message))
...
            # notify Arduino
            strMessage = "Test"
            ser.write('!' + strMessage + '\n')

One disadvantage: You have to change Lininos inittab so that Bridge can not grab your ttyATH0.

Another way I will experiment with is using SPI instead of serial tty.

BTW: If you care about memory consumption, stay away from String class. This takes 1.5K of memory. And from using float.