Skip to content

Instantly share code, notes, and snippets.

View futureshocked's full-sized avatar

Peter Dalmaris futureshocked

View GitHub Profile
@futureshocked
futureshocked / robertscode.ino
Created July 24, 2019 22:35
an exit button that opens a door
// Define interfaces
#define LED_PIN 26 // —>|–[R]—3v3
#define RELAY_PIN 33
#define BUTTON_PIN 25 // —./.—-0V
// Define Timings
#define LED_ACTIVE_ON 0.2 // Flashing when relay output is active
#define LED_ACTIVE_OFF 0.2 // Time in seconds
#define LED_IDLE_ON 12 // On with short turn off when idle
#define LED_IDLE_OFF 0.5
#define RELAY_INTERVAL 6 // duration relay operates in seconds
@futureshocked
futureshocked / 03.20_-_Grove_momentary_button.ino
Last active July 30, 2019 00:37
This sketch demonstrates how to use the Grove momentary button. The momentary button is a digital device (i.e. it can be "on" or "off" only).
/* 03.020 - Grove momentary button
*
This sketch demonstrates how to use the Grove momentary button.
The momentary button is a digital device (i.e. it can be "on" or "off" only).
Components
----------
@futureshocked
futureshocked / 03.30_-_Grove_touch_sensor.ino
Last active July 30, 2019 00:37
This sketch demonstrates how to use the Grove touch sensor. The touch sensor is a digital device (i.e. it can be "on" or "off" only).
/* 03.030 - Grove touch sensor
This sketch demonstrates how to use the Grove touch sensor.
The touch sensor is a digital device (i.e. it can be "on" or "off" only).
Components
----------
@futureshocked
futureshocked / 03.40_-_Grove_rotary_potentiometer.ino
Last active July 30, 2019 00:49
This sketch demonstrates how to use the Grove rotary potentiometer.
/* 03.040 - Grove rotary potentiometer
*
This sketch demonstrates how to use the Grove rotary potentiometer.
The momentary button is an analog device (i.e. it outputs a voltage
level that depends on the position of the knob).
Components
----------
@futureshocked
futureshocked / 04.10_-_Grove_temperature_sensor.ino
Last active July 30, 2019 00:51
This sketch read the voltage of a Grove temperature sensor and calculates the temperature in degrees C.
/* 04.010 - Grove temperature sensor (Temperature Sensor V1.1/1.2)
*
This sketch read the voltage of a Grove temperature sensor and
calculates the temperature in degrees C.
The temperature sensor is an analog sensor.
Components
----------
@futureshocked
futureshocked / 04.20_-_Grove_analog_light_sensor.ino
Created July 30, 2019 00:52
This sketch demonstrates how to use the Grove analog light sensor.
/* 04.020 - Grove analog light sensor
This sketch demonstrates how to use the Grove analog light sensor.
The analog light sensor is an analog device. It outputs a voltage
level that depends on the intensity of ambient light.
Upload this sketch and start the Serial monitor (you can also use
the serial plotter). Wave your hand over the sensor and notice the
change in the output displayed in the monitor.
@futureshocked
futureshocked / 04.30_-_Grove_sound_sensor.ino
Last active July 30, 2019 00:54
This sketch demonstrates how to use the Grove sound sensor.
/* 04.030 - Grove sound sensor
*
This sketch demonstrates how to use the Grove sound sensor.
The sound sensor is an analog device. It outputs a voltage
level that depends on the intensity of the sound it captures.
This sketch calculates the volume of the sound based on the
last 32 samples it captures.
Upload this sketch and start the Serial monitor (you can also use
@futureshocked
futureshocked / 05.10_-_Grove_LED_kit.ino
Last active July 30, 2019 00:56
This sketch demonstrates how to use the Grove LED kit.
/* 05.010 - Grove LED module
*
This sketch demonstrates how to use the Grove LED kit.
This module contains a header in which you can attach an LED. Take care
to connect the anode (long pin) of the LED into the socket marked with "+".
The cathode should go to the socket marked with "-".
You can use a Phillips screwdriver to adjust the brightens by turning the
on-board potentiometer.
@futureshocked
futureshocked / 05.40_-_Grove_buzzer_module.ino
Created July 30, 2019 00:58
This sketch demonstrates how to use the Grove buzzer module to make noise. This Gist contains two files.
/* 05.040 - Grove buzzer module
This sketch demonstrates how to use the Grove buzzer module to make noise.
This sketch is supported by a second file that contains definitions of tone names
and their frequencies. We use these tones to play some music.
Components
----------
@futureshocked
futureshocked / 05.50_-_Grove_relay_module.ino
Last active July 30, 2019 01:00
This sketch demonstrates how to use the Grove relay module.
/* 05.50 - Grove Relay module
*
This sketch demonstrates how to use the Grove relay module.
This sketch is identical to the one from 05.10, that we used with the
LED kit module. We'll use a digital pin to energise the relay coil, and
drive a large electrical load.
The load can be anything the draws less than 10A current and 30V.