09
Crowduino UNO-SD/Arduino UNO x1
Crowtail – Base Shield x1
Crowtail – LED(Red) x1
Crowtail – Water Sensor x1
Crowtail – Cable x2
USB Cable x1
Required Parts
STEP1:
Plug the Crowtail-Base Shield
onto the Arduino or Crowduino Board.
Hardware Connection
STEP2:
Connect Crowtail-LED to
Crowtail-Base shield’s D4 and
Crowtail-Water sensor to D5 port.
The complete connection is as
follows:
Open the
P03_Raining_Reminder
with Arduino IDE and upload it.
Do you have the experience of getting clothes wet by the rain? You
won't experience such a disaster again. In this course, we will use
water sensor and make a rain reminder, so that it can immediately
remind you to collect clothes when it starts to rain!
When you put the water drop on the sensor traces of the water sensor, the led will light on. When you
dry the water, the led will light off.
What will you see
1. Declare the variables for water sensor and LED and assign values to them.
2. Define whether the module is output or input.
3. Read the value of the water sensor.
4. If the value of the water sensor is LOW(water detected), led light on.
5. If the value of the water sensor is HIGH(no water detected), led light off.
Code overview
First, we declare two variables named ledPin and waterPin and assign them 4 and 5 respectively.
Integer Variables: int ledPin = 4; int waterPin = 5; int waterState = 0;
Code usage
Содержание Crowtail
Страница 48: ......