npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lite-avrgirl-lilypad

v1.0.5

Published

A NodeJS library for flashing compiled sketch files to Arduino Lilypad boards.

Downloads

12

Readme

Build Status Coverage Status

lite-avrgirl-lilypad

A lighter version of avrgirl-arduino for flashing compiled sketch files to lilypad boards.

What is this?

lite-avrgirl-lilypad is a NodeJS library written to present a convenient way to upload precompiled sketches to an Arduino lilypad.

How to install

  1. Install NodeJS from nodejs.org
  2. Run npm install lite-avrgirl-lilypad in your shell of choice

For Windows 7 users

We are working on driver compatibility issues on W7. Be patient !

How do I use it?

Your first task is to source a pre-compiled .hex file of the sketch you're interested in uploading to your Arduino. It needs to be compiled for your specific Arduino. You'll find some example hex files for each board within the junk/hex folder of this repo, however if you'd like to use your own, see this guide if you're unsure of how to go about this.

Already have a .hex file in a Buffer object ready to go? No problem! Pass this Buffer object in instead of the file path string, and lite-avrgirl-lilypad will take care of the rest. Hooray!

The following example code should get you up and running with an Arduino Uno:

var Avrgirl = require('lite-avrgirl-lilypad');

var avrgirl = new Avrgirl({});

avrgirl.flash('Blink.cpp.hex', function (error) {
  if (error) {
    console.error(error);
  } else {
    console.info('done.');
  }
});

You can optionally specify a port to connect to the Arduino, but if you omit this property avrgirl will do a pretty good job of finding it for you.

Specifying the port would look something like this:

var avrgirl = new Avrgirl({
  port: '/dev/cu.usbmodem1412'
});

You can list available USB ports programmatically using the the list method:

Avrgirl.list(function(err, ports) {
  console.log(ports);
  /*
  [ { comName: '/dev/cu.usbmodem1421',
  	   manufacturer: 'Arduino (www.arduino.cc)',
      serialNumber: '55432333038351F03170',
      pnpId: '',
      locationId: '0x14200000',
      vendorId: '0x2341',
      productId: '0x0043',
      _standardPid: '0x0043' } ]
  */
});

Alternatively, you can use the CLI to list active ports:

$ lite-avrgirl-lilypad list
[ { comName: '/dev/cu.usbmodem1421',
  	 manufacturer: 'Arduino (www.arduino.cc)',
    serialNumber: '55432333038351F03170',
    pnpId: '',
    locationId: '0x14200000',
    vendorId: '0x2341',
    productId: '0x0043',
    _standardPid: '0x0043' } ]

Like logs? Turn on debug mode to see simple flashing progress logs in the console:

var avrgirl = new Avrgirl({
  // turn on debug mode!
  debug: true
});

A sample:

found uno on port /dev/cu.usbmodem14141
connected
flashing, please wait...
flash complete.

Prefer your own custom debug behaviour? No Problem!

You can pass in your own debug function instead of a boolean, and lite-avrgirl-lilypad will run that instead.

Example:

var myCustomDebug = function(debugLogString) {
  // do your own debug stuff in here
}

var avrgirl = new Avrgirl({
  // turn on debug with your own function
  debug: myCustomDebug
});

Can I use lite-avrgirl-lilypad as a CLI tool?

You sure can!

Run npm install -g lite-avrgirl-lilypad in a shell session to install globally for easy CLI use.

The same example above would look like the following as a CLI call in your shell:

lite-avrgirl-lilypad flash -f Blink.cpp.hex

Required flags:

  • -f specify the location of the hex file to flash

Optional flags:

  • -p will allow you to specify the port where your Arduino is plugged in.
  • -v will turn on debug/verbose mode, which will print a log of things when you run the command.

As well as listing all available USB devices on your computer:

lite-avrgirl-lilypad list

The output will be presented in JSON format, very similar to the output of the Serialport.list() method (if you've used node-serialport before).

Sourcing a compiled Arduino hex file

A .hex file is the compiled end result of an Arduino sketch file. I have provided some example hex files for each board within the junk/hex folder of this repo. Feel free to use these, or if you're after something specific not provided, see the directions below.

The most common way to compile a sketch for your Arduino of choice is to download and install the Arduino IDE. Ensure you install version 1.6.5 or greater for the following steps.

  1. Open the sketch file you'd like to export, or write a new one if you need to.
  2. Choose the correct target Arduino board you want to compile the hex file for, from the Tools -> Board menu.
  3. Export your hex file by navigating to Sketch -> Export compiled binary screenshot of the Sketch menu in Arduino IDE with Export compiled binary menu item highlighted in blue
  4. You can find the exported hex file in the same directory your sketch file is located in.