Sponsored Content
Full Discussion: More Arduino Stuff...
Top Forums Programming More Arduino Stuff... Post 303042442 by Neo on Tuesday 24th of December 2019 10:24:48 PM
Old 12-24-2019
Good stuff, thanks for sharing!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use The Terminal To Test Arduino Is Working.

Hi all... (Apologies for any typos at all.) This is a step by step _script_ to check if your Arduino is talking to your Linux or Macbook Pro computer using the Terminal... It works on at least 3 Linux flavours and now the Macbook Pro... I hope you find it useful as a simple check for... (0 Replies)
Discussion started by: wisecracker
0 Replies

2. OS X (Apple)

Arduino Diecimila Board Access...

This is a very simple starter DEMO to access Arduino Diecimila Board for the Macbook Pro 13" OSX 10.7.5... A potentiometer is connected between 5V and Gnd with the wiper connected to ANALOG IN 0 on the Arduino. This was adjusted to give the Ms and Ls as seen... I now have DC in for this... (0 Replies)
Discussion started by: wisecracker
0 Replies

3. OS X (Apple)

Semi-Automatic Arduino Detection.

I am working on a semi-auto detection idea for Arduino for the Scope project. It does require a little user intervention but minimal. It works by just responding to two on screen prompts to unplug and plug Arduino into a USB port. There are two versions and both work perfectly well and give... (3 Replies)
Discussion started by: wisecracker
3 Replies

4. Programming

Very Basic Arduino Uno Board Testing

A very simple Arduino board test... LOL Here is some very easy code to test a cheap Arduino board I just got from China via Aliexpress. I am still waiting on a about 30 more orders from Aliexpress for more Arduino stuff. This was the first order which made it here. /* Arduino test-code... (18 Replies)
Discussion started by: Neo
18 Replies

5. Programming

Arduino-cli - Uploading to Unknown Chinese Arduino Boards using the Arduino Command Line Interface

In my further exploration of Arduino, today I decided to install the arduino-cli on my mac today. https://github.com/arduino/arduino-cli I followed the instructions for macOS but when I got to this part: arduino-cli board list I got the dreaded "Unknown" Fully Qualified Board Name... (1 Reply)
Discussion started by: Neo
1 Replies

6. Programming

Arduino UNIX Time - Syncing Computer UNIX Time to Arduino Time with Python

Just finished a quick Python script to send the current unix time over to the Arduino from macOS, so in the absence of GPS or some other way to get the unix timestamp (epoch time) to the Arduino, I can get my macOS and Arduino UNO synced to within a second. Normally, when the Arduino starts... (9 Replies)
Discussion started by: Neo
9 Replies

7. Programming

Arduino Project with NB-IoT (3GPP) and LoRa / LoRaWAN

My favorite projects are always related to the "latest" tech in command and control, networking and network communications. This Elecrow GSM/GPRS/EDGE SIM5360E 3G Shield seems to be the "latest and the greatest" as far as 3G and GPS, as far as I can see so far, but I has it drawbacks for sure.... (6 Replies)
Discussion started by: Neo
6 Replies

8. Programming

NB-IoT Arduino Shield from AIS (Thailand) First Impressions

Today I received my NB-IoT Arduino Shield for AIS (Thailand). Here is a "pinout" photo of the shield. My shield looks just like the one above, for the most part. I'll post another photo of the actual device later. When I received the shield in the mail, I went immediately to a local... (8 Replies)
Discussion started by: Neo
8 Replies

9. Programming

Elecrow GSM/GPRS/EDGE SIM5360E 3G Shield for Arduino

Normally I have very good experiences buying from AliExpress, but in this case with Elecrow, I'm disappointed. After confirming with Elecrow on AliExpress that their Elecrow GSM/GPRS/EDGE SIM5360E 3G Shield for Arduino would work with 3G SIM cards in Thailand, I purchased one. My plan was to... (1 Reply)
Discussion started by: Neo
1 Replies

10. Hardware

Arduino Robot Tank Project

Normally I'm not into kits, but I thought my wife would enjoy this one since she is a big fan of robots and droids on StarWars! We are done with the basic mechanical assembly and starting on the electronics assembly today. The robot's "brain" consists of three levels. The Arduino board, on... (5 Replies)
Discussion started by: Neo
5 Replies
Moose::Meta::Attribute::Native::Trait::Array(3) 	User Contributed Perl Documentation	   Moose::Meta::Attribute::Native::Trait::Array(3)

NAME
Moose::Meta::Attribute::Native::Trait::Array - Helper trait for ArrayRef attributes VERSION
version 2.0604 SYNOPSIS
package Stuff; use Moose; has 'options' => ( traits => ['Array'], is => 'ro', isa => 'ArrayRef[Str]', default => sub { [] }, handles => { all_options => 'elements', add_option => 'push', map_options => 'map', filter_options => 'grep', find_option => 'first', get_option => 'get', join_options => 'join', count_options => 'count', has_options => 'count', has_no_options => 'is_empty', sorted_options => 'sort', }, ); no Moose; 1; DESCRIPTION
This trait provides native delegation methods for array references. DEFAULT TYPE
If you don't provide an "isa" value for your attribute, it will default to "ArrayRef". PROVIDED METHODS
o count Returns the number of elements in the array. $stuff = Stuff->new; $stuff->options( [ "foo", "bar", "baz", "boo" ] ); print $stuff->count_options; # prints 4 This method does not accept any arguments. o is_empty Returns a boolean value that is true when the array has no elements. $stuff->has_no_options ? die "No options! " : print "Good boy. "; This method does not accept any arguments. o elements Returns all of the elements of the array as an array (not an array reference). my @option = $stuff->all_options; print "@options "; # prints "foo bar baz boo" This method does not accept any arguments. o get($index) Returns an element of the array by its index. You can also use negative index numbers, just as with Perl's core array handling. my $option = $stuff->get_option(1); print "$option "; # prints "bar" If the specified element does not exist, this will return "undef". This method accepts just one argument. o pop Just like Perl's builtin "pop". This method does not accept any arguments. o push($value1, $value2, value3 ...) Just like Perl's builtin "push". Returns the number of elements in the new array. This method accepts any number of arguments. o shift Just like Perl's builtin "shift". This method does not accept any arguments. o unshift($value1, $value2, value3 ...) Just like Perl's builtin "unshift". Returns the number of elements in the new array. This method accepts any number of arguments. o splice($offset, $length, @values) Just like Perl's builtin "splice". In scalar context, this returns the last element removed, or "undef" if no elements were removed. In list context, this returns all the elements removed from the array. This method requires at least one argument. o first( sub { ... } ) This method returns the first matching item in the array, just like List::Util's "first" function. The matching is done with a subroutine reference you pass to this method. The subroutine will be called against each element in the array until one matches or all elements have been checked. my $found = $stuff->find_option( sub {/^b/} ); print "$found "; # prints "bar" This method requires a single argument. o first_index( sub { ... } ) This method returns the index of the first matching item in the array, just like List::MoreUtils's "first_index" function. The matching is done with a subroutine reference you pass to this method. The subroutine will be called against each element in the array until one matches or all elements have been checked. This method requires a single argument. o grep( sub { ... } ) This method returns every element matching a given criteria, just like Perl's core "grep" function. This method requires a subroutine which implements the matching logic. my @found = $stuff->filter_options( sub {/^b/} ); print "@found "; # prints "bar baz boo" This method requires a single argument. o map( sub { ... } ) This method transforms every element in the array and returns a new array, just like Perl's core "map" function. This method requires a subroutine which implements the transformation. my @mod_options = $stuff->map_options( sub { $_ . "-tag" } ); print "@mod_options "; # prints "foo-tag bar-tag baz-tag boo-tag" This method requires a single argument. o reduce( sub { ... } ) This method turns an array into a single value, by passing a function the value so far and the next value in the array, just like List::Util's "reduce" function. The reducing is done with a subroutine reference you pass to this method. my $found = $stuff->reduce_options( sub { $_[0] . $_[1] } ); print "$found "; # prints "foobarbazboo" This method requires a single argument. o sort o sort( sub { ... } ) Returns the elements of the array in sorted order. You can provide an optional subroutine reference to sort with (as you can with Perl's core "sort" function). However, instead of using $a and $b in this subroutine, you will need to use $_[0] and $_[1]. # ascending ASCIIbetical my @sorted = $stuff->sort_options(); # Descending alphabetical order my @sorted_options = $stuff->sort_options( sub { lc $_[1] cmp lc $_[0] } ); print "@sorted_options "; # prints "foo boo baz bar" This method accepts a single argument. o sort_in_place o sort_in_place( sub { ... } ) Sorts the array in place, modifying the value of the attribute. You can provide an optional subroutine reference to sort with (as you can with Perl's core "sort" function). However, instead of using $a and $b, you will need to use $_[0] and $_[1] instead. This method does not define a return value. This method accepts a single argument. o shuffle Returns the elements of the array in random order, like "shuffle" from List::Util. This method does not accept any arguments. o uniq Returns the array with all duplicate elements removed, like "uniq" from List::MoreUtils. This method does not accept any arguments. o join($str) Joins every element of the array using the separator given as argument, just like Perl's core "join" function. my $joined = $stuff->join_options(':'); print "$joined "; # prints "foo:bar:baz:boo" This method requires a single argument. o set($index, $value) Given an index and a value, sets the specified array element's value. This method returns the value at $index after the set. This method requires two arguments. o delete($index) Removes the element at the given index from the array. This method returns the deleted value. Note that if no value exists, it will return "undef". This method requires one argument. o insert($index, $value) Inserts a new element into the array at the given index. This method returns the new value at $index. This method requires two arguments. o clear Empties the entire array, like "@array = ()". This method does not define a return value. This method does not accept any arguments. o accessor($index) o accessor($index, $value) This method provides a get/set accessor for the array, based on array indexes. If passed one argument, it returns the value at the specified index. If passed two arguments, it sets the value of the specified index. When called as a setter, this method returns the new value at $index. This method accepts one or two arguments. o natatime($n) o natatime($n, $code) This method returns an iterator which, on each call, returns $n more items from the array, in order, like "natatime" from List::MoreUtils. A coderef can optionally be provided; it will be called on each group of $n elements in the array. This method accepts one or two arguments. o shallow_clone This method returns a shallow clone of the array reference. The return value is a reference to a new array with the same elements. It is shallow because any elements that were references in the original will be the same references in the clone. BUGS
See "BUGS" in Moose for details on reporting bugs. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.16.2 2012-09-19 Moose::Meta::Attribute::Native::Trait::Array(3)
All times are GMT -4. The time now is 05:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy