This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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 | |
| ---------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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 | |
| ---------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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 | |
| ---------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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 | |
| ---------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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. |