Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vilicvane/ruff-menu

Awesome Menu for Ruff LCD (lcd1602).
https://github.com/vilicvane/ruff-menu

Last synced: about 2 months ago
JSON representation

Awesome Menu for Ruff LCD (lcd1602).

Awesome Lists containing this project

README

        

# Ruff Menu

Awesome Menu for Ruff LCD (lcd1602).

GitHub

![LCD](https://cloud.githubusercontent.com/assets/970430/14779534/17cbf1d2-0b0b-11e6-9025-bc528a3f96f2.jpg)

## Install

```sh
rap install menu
```

## Usage

Here's a example creating multi-level menu:

```js
'use strict';

var Menu = require('menu');

var lcd;
var menu;

$.ready(function (error) {
if (error) {
console.log(error);
return;
}

lcd = $('#lcd');
lcd.hideCursor();

menu = new Menu(lcd, [
{
text: 'Option One',
value: 'one'
},
{
text: 'Option Two',
value: 'two'
},
{
text: 'Nested Menu',
items: [
{
text: 'Sub Option One',
value: 'sub.one'
},
{
text: 'Sub Option Two',
value: 'sub.two'
},
{
text: 'Nested Nested Menu',
items: [
{
text: 'vane.life',
value: 'http://vane.life'
}
]
}
]
},
{
text: 'Cancel'
}
]);

$('#button-k2').on('push', function () {
menu.next();
});

$('#button-k3').on('push', function () {
menu.select();
});

menu
.show()
.then(function (result) {
lcd.print('result:', result || '(empty)');
});
});

$.end(function () {
menu.hide();
});
```

## License

MIT License.