Fork me on GitHub

Seedstudio Grove videos

Button

load('api_grove.js');
Grove.Button.attach(5, function() {
  print('clicked');
});

Motion Sensor

load('api_grove.js');
Grove.MotionSensor.attach(4, function() {
  print('Motion detected!');
});

Light Sensor

load('api_grove.js');
Grove.Button.attach(5, function() {
  print('Light: ', Grove.LightSensor.get(0));
});

Moisture Sensor

load('api_grove.js');
Grove.Button.attach(5, function() {
  print('Moisture: ', Grove.MoistureSensor.get(0));
});

UV Sensor

load('api_grove.js');
Grove.Button.attach(5, function() {
  print('clicked, UV:', Grove.UVSensor.get(0));
});

Relay

load('api_grove.js');
Grove.Button.attach(5, function() {
  let pin = 4;
  let closed = Grove.Relay.isClosed(pin);
  print('clicked', closed);
  if (closed) {
    Grove.Relay.open(pin);
  } else {
    Grove.Relay.close(pin);
  }
});

Buzzer

load('api_grove.js');
Grove.Button.attach(5, function() {
  print('clicked', GPIO.toggle(4));
});