Arduino Due libraries (official and 3rd party)

The AccelStepper library works beautifully with the Due. (Using step/dir based driver board.)

Desc:
High performance Non-Blocking (or blocking if desired).
Stepper library written in C++

Developmental Assets:
Very well documented.

Library: pwm01.h
Description: A clean alternate approach for setting up unique PWM frequencies from within a sketch, for any or all PWM pins. The trick is to utilize the two PWM clocks (CLKA & CLKB) provided by the SAM3X8E chip.

I wrote and enclosed a library (pwm01.h). It includes 4 user functions to: 1) setup PWM resolution, 2) setup PWM pin, frequency & pick clock, 3) write duty cycle, and 4) stop PWM. See example code for usage:

#include "C:\Programs\arduino-1.5.1r2\hardware\arduino\sam\libraries\Pwm01\pwm01.h"

void setup() 
{
    uint32_t  pwm_duty = 32767;
    uint32_t  pwm_freq1 = 2;  
    uint32_t  pwm_freq2 = 5000;

    // Set PWM Resolution
    pwm_set_resolution(16);  

    // Setup PWM Once (Up to two unique frequencies allowed
    //-----------------------------------------------------    
    pwm_setup( 6, pwm_freq1, 1);  // Pin 6 freq set to "pwm_freq1" on clock A
    pwm_setup( 7, pwm_freq2, 2);  // Pin 7 freq set to "pwm_freq2" on clock B
    pwm_setup( 8, pwm_freq2, 2);  // Pin 8 freq set to "pwm_freq2" on clock B
    pwm_setup( 9, pwm_freq2, 2);  // Pin 9 freq set to "pwm_freq2" on clock B
      
    // Write PWM Duty Cycle Anytime After PWM Setup
    //-----------------------------------------------------    
    pwm_write_duty( 6, pwm_duty );  // 50% duty cycle on Pin 6
    pwm_write_duty( 7, pwm_duty );  // 50% duty cycle on Pin 7
    pwm_write_duty( 8, pwm_duty );  // 50% duty cycle on Pin 8
    pwm_write_duty( 9, pwm_duty );  // 50% duty cycle on Pin 9

    delay(30000);  // 30sec Delay; PWM signal will still stream
        
    // Force PWM Stop On All Pins
    //-----------------------------    
    pwm_stop( 6 );
    pwm_stop( 7 );
    pwm_stop( 8 );
    pwm_stop( 9 );
}

void loop() 
{  
}

The pwm01.h library and example code were tested in IDE 1.5.1r2. Additional notes on this library:

  • Applies to Arduino-Due board, PWM pins 6, 7, 8 & 9.
  • Libary Does not operate on the TIO pins.
  • Unique frequencies set via PWM Clock-A (“CLKA”) and Clock-B (“CLKB”)
    Therefore, up to two unique frequencies allowed.
  • Set max duty cycle counts (pwm_max_duty_Ncount) equal to 255 per Arduino approach.
    This value is best SUITED for low frequency applications (2hz to 40,000hz) such as
    PWM motor drivers, 38khz infrared transmitters, etc.
  • Future library versions will address high frequency applications.
  • Arduino’s “wiring_analog.c” function was very helpful in this effort.

pwm01.h (3.96 KB)

Encoder has been updated to support Arduino Due.

http://www.pjrc.com/teensy/td_libs_Encoder.html

Bitlash is confirmed up and running on the Due, thanks to patches submitted by a friendly user.

http://bitlash.net

Regards to all,

-br

ShiftOutMega.h

http://www.4shared.com/get/QSUfwzo4/ShifOutMega.html

DS1307.h

http://www.4shared.com/get/HIZiPup2/DS1307.html

Hi!
As i like libraries, i have done one for Timers on the Arduino DUE.

You can check it out here: GitHub - ivanseidel/DueTimer: ⏳ Timer Library fully implemented for Arduino DUE

All 6 timers are fully implemented, and ready to play with…

I made a (very basic) library to interface with the FTDI Vdrive2 module. Uses TX1/RX1 for communication with the Vdrive2 and TX0/RX0 to send the responses to the Serial Monitor.

https://github.com/prphntm63/VDRIVE2.git

Improvements welcome ;)

I can confirm that the Xbee Library works on DUE. I ported over my code and tested last night.

http://code.google.com/p/xbee-arduino/

ivanseidel: Hi! As i like libraries, i have done one for Timers on the Arduino DUE.

You can check it out here: https://github.com/ivanseidel/DueTimer

All 6 timers are fully implemented, and ready to play with...

I have merged all the features of my timer library with his. This is a great timer library, and we would love feedback for any features that people would like to see.

The Time library has been updated for compatibility with Arduino Due.

http://playground.arduino.cc/Code/Time

A Due-specific example was added, using Markus Lange's rtc_clock library to access the Due's on-chip RTC.

[quote author=Paul Stoffregen link=topic=144446.msg1190733#msg1190733 date=1365357179] The Time library has been updated for compatibility with Arduino Due.

http://playground.arduino.cc/Code/Time

A Due-specific example was added, using Markus Lange's rtc_clock library to access the Due's on-chip RTC. [/quote]

What on-chip RTC? I just built a DS1307 project for Arduino Mini; does the Arduino Due have an internal RTC so a chip like DS1307 is not needed?

[quote author=Kuya Marc link=topic=144446.msg1193606#msg1193606 date=1365519313] What on-chip RTC? [/quote]

Due does have an on-chip RTC. The way the reset signals are wired makes it less useful for many projects, but there is indeed a RTC on the chip.

For more info, please download the new version of the Time library and look at its TimeArduinoDue example. You'll also need Markus's rtc_clock libary. Again, see the comments in TimeArduinoDue for more info.

ivanseidel: Hi! As i like libraries, i have done one for Timers on the Arduino DUE.

You can check it out here: https://github.com/ivanseidel/DueTimer

All 6 timers are fully implemented, and ready to play with...

May I ask you how I can use your file? I cannot include any library from out side. Is there anyway to run within one file? I would like to use a timer and change the REG by Serial Monitor.

henrimontreal:

ivanseidel: Hi! As i like libraries, i have done one for Timers on the Arduino DUE.

You can check it out here: https://github.com/ivanseidel/DueTimer

All 6 timers are fully implemented, and ready to play with...

May I ask you how I can use your file? I cannot include any library from out side. Is there anyway to run within one file? I would like to use a timer and change the REG by Serial Monitor.

Hi, If you want to include the library to your project, than all you nees to do is to copy DueTimer.h and DueTimer.cpp to your sketch folder and include it normaly (#include "DueTimer.h"). What do you mean by change REG? And might I ask why can't you install the library? Thanks, Ivan

I ported Ken Shirriff's IRremote library to work with the Due with a few improvements: https://github.com/enternoescape/Arduino-IRremote-Due

Note: Don't forget to use a transistor to drive the IR LED. It might work powered directly, but probably not for long. :)

I updated the RF24 (Nordic nRF24L01+) library to run on the Due. I ran the basic ping/pong dyn example for testing.

Code: https://github.com/mcrosson/RF24

Edit: You'll need to use the "due" branch from the above repo with the DUE.

Hi!

Finaly, I made the code independent from my own aplications, and could sucessfuly comment EVERY line of code.

What am I talking about?

Well, it's the First, Object Oriented User Interface for Arduino, with an Advanced controller of Touch and Views

https://github.com/ivanseidel/ArdUI/wiki

All based in Events and Callbacks, and also inspired on real Android code, you can easily implement whatever you want with it.

Some key features: * Touch is handled BOTH in interrupt and Timer (Once a touch is triggered on the interrupt, Timer is the one who start trigering the event. Once no touch is detected, controll is passed to the Interrupt)

  • Callbacks. Every view has it's own callbacks and events. onClick, onTouch, onChange.

  • Touch Events. Like Android, touch events are implemented, such as: ACTION_DOWN, ACTION_UP, ACTION_MOVE, ACTION_HOVER_ENTER, ACTION_HOVER_EXIT

  • Views are implemented extending main class View, or other that implements View. Object oriented allows user to extend a class and improve whatever he wants to. Views already implemented: SeekBar, ProgressBar, Button, CheckBox, TextView and ViewGroup, that allows many views in a single views.

  • Tree Rendering: Once a render is triggered, the view start rendering it's own tree. For example: If you have 5 views inside a ViewGroup, and one of the 5 is also a ViewGroup containing more 10 views, calling a "render()" on the top view of the tree, will start rendering all the views. Also, calling a "render(false)" will start rendering ONLY the "invalidated" views (only what is necessary).

  • Relative rendering: If one view is inside the other, it's relative to the other. One position in a view is ALWAYS relative to it's parent. Moving a view that has views inside, cause it's childs to move with it. Rendering, and Touch are handled relative also.

  • Changing Between rootViews is very easy (for example, running another function, state,...). Prepare all your views, and then register the current one on ArdUI. He will make the rest...

Documentation is not done yet, and there is a lot to be done (and improved). I'm using it currently on my robots: TendaDigital.net and it seems to be VERY robust and thrustable.

This is the kind of library, that does everything, you just need to know how to use it (Yet, a little complicated, since I'm still documenting).

Hi, I always use this library for myself, and I personaly think that is VERY usefull. Its clear that Arduino doesen't support real parallel processes, but we can "sort" of do it with scheduled tasks.

Yes, there is already an class called "Scheduller", but for big projects (likes the ones I do, with more than 15.000 lines), it's not "good" enought...

I LOVE Object Oriented stuff, and this follows it pretty much.

Check out the library here: https://github.com/ivanseidel/ArduinoThread

It also works for ANY arduino, but I implemented thinking on the DUE, since it's capable of more stuff (I use it with my ArduinOS, and it's just perfect =] )

Any suggestions are welcome!

First version of the DueGUI library is now downloadable...

http://forum.arduino.cc/index.php?topic=164788.0

Hey everyone,

I rewrote the T6963 library to interface a graphics LCD using the Toshiba driver with the arduino due.
It is significantly faster than the old version since all data bus lines are on port C of the AT91. All pins used are on the vertical 18*2 pin connector what allows you to use a ribbon cable.
Examples and instructions to hook it up included.

Edit: Fixed bug for UpdateBuff(), speed optimizations

T6963_due_0_31.zip (10.8 KB)