Author Topic: Servo/ESC/Digital output sequences: Yes, the DS can do it automagically!  (Read 3812 times)

RC Navy

  • Jr. Member
  • **
  • Posts: 54
  • When you like, even too much, it is not enough!
Hi,

after some troubles (solved now: see: http://digistump.com/board/index.php/topic,841.msg2777.html#msg2777), I can present you an amazing little library to run "complex" sequences with the Digispark: <RcSeq>.
<RcSeq> is a library which relies on the <TinyPinChange>, <SoftRcPulseIn> and <SoftRcPulseOut> libraries already presented here:
http://digistump.com/board/index.php/topic,689.0.html

<RcSeq> is designed to run predefined sequences (yes, you can define several sequences) which use servos/ESC and short actions (for ex: toggling a digital output). The short sequence duration shall be < 20 ms to not disturb the servo motions. The servo motions can reach several seconds.
The servos motion (intial angle, final angle, duration of the motion, percentage of motion which must be performed at half speed, initial start and duration) and short actions are described in a sequence table in flash memory. Several servos can turn simultaneously (nested commands).

A little diagram to explain what can do <RcSeq>:

- BP# stands for Push Button#,
- Emetteur stands for Transmitter,
- Récepteur stands for Receiver,
- Voie stands for Channel,
- Manche stands for Stick,
- Action courte stands for Short Action
- Clavier stands for Keyboard (Push Buttons)
- Inverse stands for toggles

The sequence(s) can be trigged with:
- a RC signal (predefined pulse width): stick position on the RC Transmitter or by using several push buttons in place of the pot of the stick
- a function called if a message is received from a <softserial> port.

The <RcSeq> library is provided with several examples:
- OnePropTo5: converts one proportionnal channel into 5 digital channels (in english specially for most of you) ;)
- RcSeqDemo: covers almost all the capabilities, sequence and short action trigger from a RC pulse (Predefined Stick position and push buttons) to put a pneumatic Zodiac from the deck of a boat to the sea whilst driving a LED (sorry, in french) :-[
- RcSeqZodiac:  sequence and short action trigger from a RC pulse (Predefined Stick position) or a message from a serial port to put a pneumatic Zodiac from the deck of a boat to the sea whilst driving a LED (sorry, in french) :-[
- UneVoieVers8: (almost the same as OnePropTo5) converts  one proportionnal channel into 8 digital channels  (sorry, in french) :-[

Now some videos to illustrate the capabilities
(credit: Alain, my hobbyist friend http://bateaux.trucs.free.fr/ageneral.html)
RcSeqZodiac sketch: http://www.youtube.com/watch?feature=player_embedded&v=2zsRZqeK31w and http://www.youtube.com/watch?feature=player_embedded&v=J5r3s4M2DJs
UneVoieVers8 sketch (extended version of OnePropTo5): http://www.youtube.com/watch?feature=player_embedded&v=gqJ5F2ifRWg

Please, note this library can not work if you are using <DigiUSB> in your sketch: this library is too time critical and must monopolize the "pin change interrupt" vector, but alternatively, you can use <SoftSerial> which is a modified version of <SoftwareSerial> because it can work with <TinyPinChange> library which allow sharing the "pin change" interruptions.

Sorry for this very long presentation, but this library is very powerful and it's not easy to detail all its capabilities...
All the details on: http://p.loussouarn.free.fr/arduino/RcSeq/LibrairieRcSeq.html (in french) :-[

Find attached all the required libraries with examples.

What do you think about commanding a skull for alloween with this lib?

Last thing, new.h and new.cpp files shall be present in the Digispark core directory, otherwise, these sketches won't compile.
See: http://digistump.com/board/index.php/topic,841.msg2777.html#msg2777
If you will use the next release of the arduino IDE for Digispark, those missing files will be already included.

Enjoy,

RC Navy
« Last Edit: March 10, 2013, 05:00:51 am by RC Navy »