summaryrefslogtreecommitdiff
path: root/datasources/arduino/arduinoAnalogHTTP/bin/ard-reset-arduino
diff options
context:
space:
mode:
authorEbus-at-dockstar <ebus@dockstar>2014-07-26 19:55:43 +0200
committerEbus-at-dockstar <ebus@dockstar>2014-07-26 19:55:43 +0200
commita8cd2ecf7387d7bbe16808ca0c7acdb04a4909cb (patch)
tree524672c3237be2552379f9d752184bd3cbf1d554 /datasources/arduino/arduinoAnalogHTTP/bin/ard-reset-arduino
parent3f5b5ff5e71cf078c2c04906bffa06f3a1050085 (diff)
downloadebus-alt-a8cd2ecf7387d7bbe16808ca0c7acdb04a4909cb.tar.gz
ebus-alt-a8cd2ecf7387d7bbe16808ca0c7acdb04a4909cb.zip
Revert "embed xexpr-path" restore datastore-leveldb and other stuff
This reverts commit f6675ccdd7a5997def3c4656f0e2c5dbbbed1fc8.
Diffstat (limited to 'datasources/arduino/arduinoAnalogHTTP/bin/ard-reset-arduino')
-rwxr-xr-xdatasources/arduino/arduinoAnalogHTTP/bin/ard-reset-arduino115
1 files changed, 115 insertions, 0 deletions
diff --git a/datasources/arduino/arduinoAnalogHTTP/bin/ard-reset-arduino b/datasources/arduino/arduinoAnalogHTTP/bin/ard-reset-arduino
new file mode 100755
index 0000000..22c7109
--- /dev/null
+++ b/datasources/arduino/arduinoAnalogHTTP/bin/ard-reset-arduino
@@ -0,0 +1,115 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+
+use Device::SerialPort;
+use Getopt::Long;
+use Pod::Usage;
+
+my %Opt =
+ (
+ period => 0.1,
+ );
+
+GetOptions(\%Opt,
+ "period=f", # width of reset pulse in seconds
+ "verbose!",
+ "help!",
+ "info!",
+ );
+
+if ($Opt{help} || $Opt{info})
+ {
+ usage();
+ }
+
+die "No Arduinos found!\n"
+ unless @ARGV;
+
+foreach my $dev (@ARGV)
+ {
+ my $p = Device::SerialPort->new($dev)
+ or die "Unable to open $dev: $!\n";
+
+ my $dt = $Opt{period};
+
+ print STDERR "Setting DTR high for ${dt}s on $dev\n"
+ if $Opt{verbose};
+
+ die "Invalid pulse width ($dt), "
+ unless $dt > 0.0;
+
+ $p->pulse_dtr_on($dt * 1000.0);
+ }
+
+## here endeth the main
+
+sub usage
+ {
+ pod2usage(-verbose => 2);
+ }
+
+__END__
+
+=head1 NAME
+
+ard-reset-arduino - Reset an Arduino
+
+=head1 USAGE
+
+ $ ard-reset-arduino /dev/cu.usb*
+
+ $ ard-reset-arduino --verbose --period=0.1 /dev/cu.usb*
+
+=head1 DESCRIPTION
+
+To reset (most) Arduinos, it's enough to just pulse the DTR line.
+
+You can do that from the shell with stty, but there's an interesting
+diversity of command flags. This little program gives a uniform interface
+at the cost of requiring C<Device::SerialPort>.
+
+=head1 OPTIONS
+
+=over
+
+=item --verbose
+
+Watch what's going on on STDERR.
+
+=item --period=0.25
+
+Specify the DTR pulse width in seconds.
+
+=back
+
+=head1 BUGS AND LIMITATIONS
+
+There are no known bugs in this application.
+
+Please report problems to the author.
+
+Patches are welcome.
+
+=head1 AUTHOR
+
+Martin Oldfield, ex-atelier@mjo.tc
+
+Thanks to Daniele Vergini who suggested this to me, and supplied
+a command line version.
+
+=head1 LICENCE AND COPYRIGHT
+
+Copyright (c) 2012, Martin Oldfield. All rights reserved.
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published
+by the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+