Hardware Reference
In-Depth Information
The scale parameter is a constant, one of either
DEGREES_C
for Celsius or
DEGREES_F
for Fahrenheit. This function returns an
int
; returned values vary
between -40° C and 150° C (or -40° F and 302° F).
The Esplora has something else uncommon for an Arduino; it has a micro-
phone. The microphone is not designed to record sounds; instead, it gives an
accurate reading of the amplitude of the ambient noise level. The value can be
read with
readMicrophone()
.
result = Esplora.readMicrophone();
This function takes no parameters and returns an
int
—the ambient sound
level—on a scale of 0 to 1,023.
Finally, the Esplora also has an accelerometer: a small device that can detect
the tilt of the device. Contrary to what some people believe from the name, an
accelerometer does not calculate coordinate acceleration (a change in velocity);
it measures proper acceleration: acceleration relative to gravity. It can therefore
detect a tilt (a change in direction relative to gravity) but also movement. (For
example, a falling device has limited acceleration attempting to counter gravi-
tational pull.)
Values can be read from the accelerometer by using
readAccelerometer()
.
value = Esplora.readAccelerometer(axis);
This function needs to be called for each axis individually. The axis is specii ed
using the
axis
parameter and is one of
X_AXIS
,
Y_AXIS
, or
Z_AXIS
. It returns an
int
between -512 and 512. A result of zero means the axis is perpendicular to
gravity: negative and positive values mean acceleration on the axis.
int x_axis = Esplora.readAccelerometer(X_AXIS);
int y_axis = Esplora.readAccelerometer(Y_AXIS);
int z_axis = Esplora.readAccelerometer(Z_AXIS);
Serial.print("x: ");
Serial.print(x_axis);
Serial.print("\ty: ");
Serial.print(y_axis);
Serial.print("\tz: ");
Serial.println(z_axis);
Buttons
The Esplora comes with an impressive array of buttons. On the left side of
the Esplora is an analog joystick and on the right side are digital buttons.
Search WWH ::
Custom Search