Objective: Learn how to implement a "too close" trigger with blinking, using an ultrasonic sensor and an LED module connected to an Arduino board that is connected to a Linkbot robot. LED module setup: Diagrams illustrating the Linkbot-Arduino-LED combination may be found here (scroll to the section at the bottom of the page on "Connecting the LED module"). Overview: As in the previous activity, the pre-placed code blocks initialize an ultrasonic sensor and use a "while" loop to keep reading the sensor as long as the distance read is greater than 3 inches. The new feature is to program an LED module that blinks green during the distance readings and red afterwards. (Details on using the LED module can be found in the "Blink RGB LED with LArduino" series of activities.) After you try running the code, modify it as directed in the Problem Statement.
|
Grid Size: S M L | Simple View: | MinView: |
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
|
Modify the pre-placed code so that the "too close" distance is 6, and it blinks red while reading the sensor and blue (pin 11) after it stops. |
|
|
|||||||||||
|
|||||||||||