edit

Project Two - Digital Input v1.0b

The purpose of this project is to demonstrate two forms of digital input – using the button Grove and the tilt switch Grove . Pressing the button will light the LED, and activating the tilt-switch will light the LED.

Wiring it:

  1. Connect the LED Module to the D1/D2 Digital I/O jack, like it was in Projects 1.

  2. Arduino Pin D1 powers the LED on the Grove's SIG connector, and Arduino Pin D2 connect to the LED Grove's NC connector.

  3. Connect the Tilt Switch Grove to the D5/D6 Digital I/O jack.

  4. The Tilt Switch Grove's SIG connector sends a high or low signal to the Arduino's D5 digital input.

  5. Connect the Button Module to the D7/D8 input jack (on the second row.)

  6. The Button Grove uses the SIG connector to send a signal to the Arduino's D7 digital input.

Now upload the following Arduino sketch:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Project Two - Digital Inputs
//

void setup()
{
  pinMode(1, OUTPUT);
  pinMode(5, INPUT);
  pinMode(7, INPUT);
}

void loop()
{

if (digitalRead(5)==HIGH)
  {
    digitalWrite(1, HIGH);
    delay(100);
    digitalWrite(1, LOW);
  }

  if (digitalRead(7)==HIGH)
  {
    digitalWrite(1, HIGH);
    delay(200);
    digitalWrite(1, LOW);
  }

}

Tech Support

Please submit any technical issue into our forum.