All Projects → mike-matera → Arduinostl

mike-matera / Arduinostl

Licence: lgpl-2.1
An STL and iostream implementation based on uClibc++ that supports my CS-11M class.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Arduinostl

Uduino
Simple and easy connection between Arduino and Unity
Stars: ✭ 25 (-87.56%)
Mutual labels:  serial-ports, arduino-library
Commander
Arduino Command Line Utility
Stars: ✭ 20 (-90.05%)
Mutual labels:  serial-ports, arduino-library
Influxdb Client For Arduino
Simple library for sending measurements to an InfluxDB with a single network request. Supports ESP8266 and ESP32.
Stars: ✭ 176 (-12.44%)
Mutual labels:  arduino-library
Dicomtomesh
A command line tool to transform a DICOM volume into a 3d surface mesh (obj, stl or ply). Several mesh processing routines can be enabled, such as mesh reduction, smoothing or cleaning. Works on Linux, OSX and Windows.
Stars: ✭ 191 (-4.98%)
Mutual labels:  stl
Md max72xx
LED Matrix Library
Stars: ✭ 186 (-7.46%)
Mutual labels:  arduino-library
Acebutton
An adjustable, compact, event-driven button library for Arduino that debounces and dispatches events to a user-defined event handler.
Stars: ✭ 180 (-10.45%)
Mutual labels:  arduino-library
Rapidyaml
Rapid YAML - a library to parse and emit YAML, and do it fast.
Stars: ✭ 183 (-8.96%)
Mutual labels:  stl
Packetserial
An Arduino Library that facilitates packet-based serial communication using COBS or SLIP encoding.
Stars: ✭ 177 (-11.94%)
Mutual labels:  arduino-library
Radio
An Arduino library to control FM radio chips like SI4703, SI4705, RDA5807M, TEA5767.
Stars: ✭ 193 (-3.98%)
Mutual labels:  arduino-library
Duetimer
⏳ Timer Library fully implemented for Arduino DUE
Stars: ✭ 184 (-8.46%)
Mutual labels:  arduino-library
Teensystep
Fast Stepper Motor Library for Teensy boards
Stars: ✭ 191 (-4.98%)
Mutual labels:  arduino-library
Cq Editor
CadQuery GUI editor based on PyQT
Stars: ✭ 183 (-8.96%)
Mutual labels:  stl
Esp32 Ble Mouse
Bluetooth LE Mouse library for the ESP32 (Arduino IDE compatible)
Stars: ✭ 180 (-10.45%)
Mutual labels:  arduino-library
Rf24audio
Arduino library for streaming data/audio from analog inputs via NRF24L01 modules
Stars: ✭ 190 (-5.47%)
Mutual labels:  arduino-library
Arduino Applemidi Library
Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
Stars: ✭ 177 (-11.94%)
Mutual labels:  arduino-library
Mayo
3D CAD viewer and converter based on Qt + OpenCascade
Stars: ✭ 192 (-4.48%)
Mutual labels:  stl
3d models
3D Models of our products
Stars: ✭ 177 (-11.94%)
Mutual labels:  stl
Hob3l
100x Faster Slicing of SCAD Files for 3D Printing
Stars: ✭ 182 (-9.45%)
Mutual labels:  stl
Easybutton
Arduino library for debouncing momentary contact switches, detect press, release, long press and sequences with event definitions and callbacks.
Stars: ✭ 187 (-6.97%)
Mutual labels:  arduino-library
Competitive Programming Resources
This repository consists of data helpful for ACM ICPC programming contest, in general competitive programming.
Stars: ✭ 199 (-1%)
Mutual labels:  stl

ArduinoSTL

This is an implementation of a C++ standard library packaged as an Arduino library. The library supports teaching my CS-11M class by adding key C++ features into the Arduino environment.

The library is ported from uClibc++:

http://git.uclibc.org/uClibc++

With a streams implementation from Andy Brown's Arduino Library:

http://andybrown.me.uk/2011/01/15/the-standard-template-library-stl-for-avr-with-c-streams/

Using printf() and scanf()

The ArduinoSTL header file contains code to bind a serial port of your choice to the stdio primitives. This happens automatically but the user must still call Serial.begin()

#include <ArduinoSTL.h>

void setup() {
  Serial.begin(9600); 
  printf("Hello World\n");
}

Using cin an cout

When you include this header file you automatically get cin and cout based on Serial. See below for how to specify your own device. Here's an example sketch using cin and cout .

#include <ArduinoSTL.h>

using namespace std;

void setup() {
  Serial.begin(9600);
  cout << "Feed me an integers." << endl;
}

void loop() {
  int foo;
  if (cin >> foo) { 
    cout << "You fed me " << foo << endl;
  }else{
    cin.clear();
    cin.ignore();
  }
}

Changing the Serial Port

You can change what serial port that cin, cout and printf() use. You can use built-in serial ports (e.g. Serial1 on Leonardo) or you can use software serial ports that implement Stream.

Using a Built-in Port

In src/ArduinoSTL.cpp change the value of ARDUINOSTL_DEFAULT_SERIAL. Leave the other defaults uncommented.

Using a SoftwareSerial port.

Set ARDUINO_DEFAULT_SERAL to NULL. Comment out the other defaults.

Here's an example sketch that uses SofwareSerial:

#include <ArduinoSTL.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1);

namespace std { 
  ohserialstream cout(mySerial);
  ihserialstream cin(mySerial);
}

void setup() {
  mySerial.begin(9600);
  ArduinoSTL_Serial.connect(mySerial);
}

Avoiding Instantiation of cin and cout

Comment out ARDUINOSTL_DEFAULT_CIN_COUT and nothing will be instantiated. You must comment out this flag if you intend to select a non-default serial port. There's no appreciable overhead for using printf() so you cannot currently avoid initializaing it.

Known Issues

Printing of floats and doubles using cout ignores format specifiers.

uClibc seems to be fairly complete. Strings and vectors both work, even with the limited amount of heap available to Arduino. The uClibc++ status page can be found here:

https://cxx.uclibc.org/status.html

Always use the latest Arduino IDE. This library uses the Arduino IDE Library Specification rev.2.1 with features only available on Arduino 1.6.10 and higher. The specification can be found here:

https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification

License

The uClibc++ library is licensed under the LGPL. This project adopts the LGPL to be compatible with the bulk of the code that it uses. Unless otherwise noted all code is licensed under the LGPL. There's one exception:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].