ArduinoShrink



  • Today I came across interesting project https://github.com/nerdralph/ArduinoShrink that promises smaller and faster code for ATmega168 and 328 MCUs at 4 to 16 MHZ.

    But the library is not compatible with mysensors

    wiring.c.o (symbol from plugin): In function `delayMicroseconds':
    (.text+0x0): multiple definition of `main'
    sketch/mys-868-node.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
    collect2: error: ld returned 1 exit status
    exit status 1
    Error compiling for board Arduino Pro or Pro Mini.
    

    Would it be possible to make it compatible? Is the problem maybe in the know limitation that when the pin is not known at compile time?



  • I'm sure ATmega 168 have too little memory to be used for run the mysensors code... so don't buy a ATmega168

    ATMega 168
    Program Memory Size (KB) 16
    SRAM (B) 1,024
    Data EEPROM/HEF (bytes) 512

    ATMega 328
    Program Memory Size (KB) 32
    SRAM (B) 2,048
    Data EEPROM/HEF (bytes) 1024



  • @bjacobse That is a bit of a myth that 168 is not useable in mysensors.... ATmegs 168 was enough for me to run a door/window node with 2 switch coneacts and temp and humidity with htu21D - it all just about fitted!

    So it is OK for small security nodes and simpler projects. But it does have half the memory so don't expect all example to fit on it.

    i use 168 for all door/window and similar as they are cheaper and do the job just as well..... 😉



  • @skywatch
    I'm amazed that you made it work, which is good in your case
    But in most cases it might not work, and your MCU will crash RAM/stack and you will have troubles to understand what goes wrong.
    https://electronics.stackexchange.com/questions/146298/what-happens-when-microcontrollers-run-out-of-ram

    So to be on se the safe side for most people, then buy 328 as it from Mouser only cost 1,92€ and the 168 costs1,40€ for the cheapest variant of each, so for a hobbyist this price is nothing compared to the troubles you might have. Naturally if you have production and manufactures thousands devices this price different is extra money in your pocket



  • @bjacobse I was surprised too as like you I had seen that they would not work with mysensors and definitely not with debug output - with 2 switches I was able to use debug output, but not after adding the htu21d (which I expected to fail, but after a little code change worked well). We live, We learn! 🙂


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 6
  • 1
  • 1
  • 198

40
Online

11.4k
Users

11.1k
Topics

112.6k
Posts