Giter VIP home page Giter VIP logo

arduino-code-optimizer's Introduction

ACO - Arduino Code Optimizer

Build Status

Reduce the memory usage of your Arduino sketch up to 90% by using the Arduino Port Manipulation.

All references to the ports used by the microcontroller can be found in its datasheet, e.g. Atmega328P.

Attention: the use of this tool on your sketch could make it to lose portability between the different Arduino microcontrollers

Getting started

Prerequisites

For launching this software you need:

  • Java 11

Usage

The program is designed for the simplest user experience. Blank Program

All you have to do is:

  • select your Arduino's code file
  • select the plugins you want to use
  • select the board
  • click "Optimize" and enjoy

A more detailed guide can be found in /docs/manual directory (Ongoing)

Optimization Example

With the classic blink code:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

we have 1460 bytes used.

But, replacing pinMode() and digitalWrite() functions with the relative port manipulation instruction:

void setup() {
  DDRB |= (1<<DDB5);
}

void loop() {
  PORTB |= 00100000;
  delay(1000);
  PORTB &= 11011111;
  delay(1000);
}

we only have 854 bytes used in memory, 42% less memory used.

And, if we replace the setup() and loop() functions with the main() function:

int main() {
  DDRB |= (1<<DDB5);
  
  while(true) {
    PORTB |= 00100000;
    delay(1000);
    PORTB &= 11011111;
    delay(1000);
  }
}

we have only 618 bytes used, 58% less memory used.

Built With

  • OpenJFX 11 - Graphic framework
  • Maven - Dependency Management

Authors

Alessandro Tornesello - Initial work - Iregon

License

This project is licensed under the MIT License - see the LICENSE.md file for details

arduino-code-optimizer's People

Contributors

iregon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.