background preloader

Libraries

Facebook Twitter

Issue 669 - arduino - Ethernet/UDP libraries loses packets if there are multiple packets in w5100 buffer - Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. LibraryTutorial. Learning Examples | Foundations | Hacking | Links This document explains how to create a library for Arduino.

LibraryTutorial

It starts with a sketch for flashing Morse code and explains how to convert its functions into a library. This allows other people to easily use the code that you've written and to easily update it as you improve the library. For more information, see the API Style Guide for information on making a good Arduino-style API for your library. We start with a sketch that does simple Morse code: int pin =13; void setup(){ pinMode(pin, OUTPUT);} void loop(){ dot(); dot(); dot(); dash(); dash(); dash(); dot(); dot(); dot(); delay(3000);} void dot(){ digitalWrite(pin, HIGH); delay(250); digitalWrite(pin, LOW); delay(250);} void dash(){ digitalWrite(pin, HIGH); delay(1000); digitalWrite(pin, LOW); delay(250);} If you run this sketch, it will flash out the code for SOS (a distress call) on pin 13.

The sketch has a few different parts that we'll need to bring into our library. #endif Morse morse(13); DateTime Arduino Library, timekeeping and time data manipulation on Teensy. DateTime, by Michael Margolis, adds timekeeping ability and provides access to to hours, minutes, seconds, days, months and years.

DateTime Arduino Library, timekeeping and time data manipulation on Teensy

Download: DateTime.zip The example was slightly modified with a default time, so it will run without needing a separate program to set the time. DateTime works on Teensy without modifications. Hardware Requirements None. Basic Usage DateTime.sync(time) description, blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah DateTime.available() DateTime.Hour DateTime.Minute DateTime.Second DateTime.Day DateTime.DayofWeek DateTime.Month DateTime.Year Example Program // DateTime.pde// example sketch for the DateTime library #include Details.

SDCardNotes. Reference Language | Libraries | Comparison | Changes Overview The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most Arduino boards) or 50, 51, and 52 (Arduino Mega).

SDCardNotes

Additionally, another pin must be used to select the SD card. This can be the hardware SS pin - pin 10 (on most Arduino boards) or pin 53 (on the Mega) - or another pin specified in the call to SD.begin(). Note that even if you don't use the hardware SS pin, it must be left as an output or the SD library won't work. Not all the functions are listed on the main SD library page, because they are part of the library's utility functions.

Formatting/Preparing the card (NB : whenever referring to the SD card, it means SD and microSD sizes, as well as SD and SDHD formats) Most SD cards work right out of the box, but it's possible you have one that was used in a computer or camera and it cannot be read by the SD library. File Naming Opening/Closing files.