The Seeed Studio Grove System is an open modular toolset, designed to minimize the difficulty of electronic engineering. Each board has unified 4pin interface and standardized jigsaw shape for easy combination.
When using the Arduino adaptor shield on the Pico, just plug the Grove Arduino Shield on top of it. A direct Grove Pico adaptor will be available soon as well.
Otherwise, you need to wire each module up to GND, VCC, and to signal wires on the Pico. The connections should be written on the board. If it specifies SDA
/SCL
, make sure you use pins on the Pico that can handle I2C.
Each 'Grove' library in Espruino expects to be given an array of 2 pins as an argument, for instance [A0,A1].
To make this easier we've added some modules with these arrays already defined, just choose from the table:
Adaptor | Module |
---|---|
Standard Arduino | arduino-grove (About Modules) |
Arduino Adaptor shield for Pico | GroveArduinoPico (About Modules) |
Pico Mini Adaptor Shield | GrovePico (About Modules) |
Once you're using the correct module, for instance with var grove = require("GrovePico");
,
you can then access the relevant pins just by typing grove.NAME
where NAME
is the name
written on the Grove board. For instance for a button connected to D2
on the Pico Shield,
you'd simply do:
var grove = require("arduino-grove").connect(); // for Pixl.js
var grove = require("GrovePico"); // for Pico Grove adaptor shield
new (require("GroveButton"))(grove.D2, function(e) {
if (e.state) console.log("Pressed");
else console.log("Released");
});
If you've wired up a grove module manually, just put the 2 pins you used in an array, and use that instead:
new (require("GroveButton"))([A0,A1], function(e) {
if (e.state) console.log("Pressed");
else console.log("Released");
});
/* Calls the callback when the button is pressed or released.
Can be plugged in anywhere
var grove = require("GrovePico");
new (require("GroveButton"))(grove.D2, print);
*/
function (pins, callback) { ... }
// Call this to stop callbacks
GroveButton.prototype.disconnect = function () { ... }
// Beep for the time specified in ms, or 500ms if nothing supplied
GroveBuzzer.prototype.beep = function (delay, callback) { ... }
/* Returns an object with the following methods:
Can be plugged in anywhere
var grove = require("GrovePico");
var b = new (require("GroveBuzzer"))(grove.D2);
b.beep(100);
*/
function (pins) { ... }
// Play at the specified frequency for the time specified in ms, or 500ms if nothing supplied
GroveBuzzer.prototype.freq = function (freq, delay, callback) { ... }
/* Grove Touch
------------------
Calls the callback when the area is pressed or released.
Can be plugged in anywhere
var grove = require("GrovePico");
new (require("GroveTouch"))(grove.D2, print);
*/
function (pins, callback) { ... }
// Call this to stop callbacks
GroveTouch.prototype.disconnect = function () { ... }
/* Allows you to read the rotation of the knob
Must be plugged into an analog socket
var grove = require("GrovePico");
var r = new (require("GroveRotation"))(grove.A0);
setInterval(function() {
console.log(r.read());
}, 500);
*/
function (pins) { ... }
// Returns a number between 0 and 1 depending on rotation
GroveRotation.prototype.read = function () { ... }
/* Grove Light Sensor
------------------
Read the amount of light falling on the sensor
Must be plugged into an analog socket
var r = new GroveLightSensor([A0,A1]);
setInterval(function() {
console.log(r.read());
}, 500);
*/
function (pins) { ... }
// Returns a number between 0 (dark) and 1 (bright)
GroveLightSensor.prototype.read = function () { ... }
/* Grove Temperature Sensor
------------------
var grove = require("GrovePico");
var r = new (require("GroveTemperature"))(grove.A0);
console.log(t.get());
*/
function (pins) { ... }
// Get the temperature in degrees C
GroveTemperature.prototype.get = function () { ... }
/* Grove Moisture Sensor
------------------
Measures the volumetric content of water in soil and gives us the moisture level
Must be plugged into an analog socket
var r = new GroveMoistureSensor(WioLTE.A4[0]);
setInterval(function() {
console.log(r.read());
}, 500);
*/
function (pin) { ... }
// Returns a number between 0 (dry) and 1 (wet)
GroveMoistureSensor.prototype.read = function () { ... }
/* Grove Relay
------------------
A relay to help you turn other circuits on and off
var l = new GroveRelay([A0,A1]);
l.off();
l.pulse(1000, function() {
console.log("Done!");
});
*/
function (pins) { ... }
// Turn relay on
GroveRelay.prototype.on = function () { ... }
// Turn relay off
GroveRelay.prototype.off = function () { ... }
// Pulse the relay for the time specified in ms, or 500ms if nothing supplied
GroveRelay.prototype.pulse = function (delay, callback) { ... }
/* Text LCD screen with an RGB backlight
--------------------------------
var grove = require("GrovePico");
var g = new (require("GroveLCDRGB"))(grove.I2C2);
g.setColor(64,128,255);
g.clear();
g.write("Hello");
g.setCursor(5,1);
g.write("World");
*/
function (pins) { ... }
// Access the LCD PWM driver
GroveLCDRGB.prototype.setReg = function (a, d) { ... }
// Send a command to the LCD
GroveLCDRGB.prototype.cmd = function (c) { ... }
// Send characters to the LCD
GroveLCDRGB.prototype.write = function (s) { ... }
// Set the LCD backlight color
GroveLCDRGB.prototype.setColor = function (r, g, b) { ... }
// Clear the display
GroveLCDRGB.prototype.clear = function () { ... }
// Return to home position
GroveLCDRGB.prototype.home = function () { ... }
// Set cursor position (0-based)
GroveLCDRGB.prototype.setCursor = function (col, row) { ... }
The Grove System Starter kits and individual parts are available directly from SeeedStudio in China, or from a range of distributors.
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.