Giter Site home page Giter Site logo

arduino-mbed-mashup's Introduction

Running Arduino sketches on Mbed OS

The new Arduino Nano 33 BLE board is a development board that runs both Arduino and Mbed OS. This is done by implementing Arduino core on top of Mbed OS, giving users the opportunity to write both Arduino sketches and Mbed OS applications at the same time. This project also allows us to add the Arduino core as a library to any Mbed OS application, thus adding support for Arduino sketches and libraries to any Mbed OS project.

This repository contains an example of running the Arduino ChainableLED sketch on Mbed OS boards. It can be used as a basis to run any Arduino sketch on any Mbed OS board.

Building with Mbed CLI

Note: You can only build this repository on a case-sensitive file system (due to naming issues around String.cpp / string.cpp). On macOS follow these instructions to create a case-sensitive mount point. On Windows, follow these instructions to enable case-sensitivity on your file system.

  1. Connect a Grove Chainable LED to pin D4/D5 on your development board.

  2. Import this application:

    $ mbed import https://github.com/janjongboom/mbed-arduino-mashup
    
  3. Build and flash the application:

    $ mbed compile -m auto -t GCC_ARM -f
    
  4. Done!

Building with the Online Compiler

Not supported. The Arduino core cannot currently be compiled under under the ARMCC compiler.

The sketch and bootstrapping

The sketch is located in source/sketch.cpp.

Arduino uses a setup and a loop function, which are unknown to Mbed OS. Thus, you'll need to call these functions manually. You'll see this at the bottom of the sketch.cpp file:

// Mbed OS bootstrap code
int main() {
    setup();

    while (1) loop();
}

Here you'll have the full power of Mbed OS on your hands, so you can start new threads, use the file system, or use one of the network drivers. See source/sketch.cpp.multithreaded for an example.

Help

  • Q: I receive errors that strlen, memmove or other functions are not found.
    • A: This project can only be built on case-sensitive file systems. See the note under 'Building with Mbed CLI'.
  • Q: I receive errors that the D0 symbol cannot be found.
    • A: Your development board doesn't support Arduino pins (in PinNames.h in Mbed OS). You need to create a custom pin map in variant.cpp.

arduino-mbed-mashup's People

Contributors

janjongboom avatar mfalkvidd 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.