Subject:
|
Re: average_sensor
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sat, 1 Nov 1997 19:48:13 GMT
|
Original-From:
|
Pandit Panburana <pdp@ix.netcom.*NoMoreSpam*com>
|
Viewed:
|
1660 times
|
| |
| |
Hi Tery,
The average_sensor() procedure prodive average
reading of a given analog port (the first parameter
of the function). The result of the sensor value
is then stored a the given variable via the pointer
given to the function via the second paramter.
Example:
void sense_temp (void)
{
int temp_value; /* temp. read from sensor */
/*
* Read the tempt from sensor at analog port
* 0.
*/
average_sensor (0, &temp_value);
if (temp_value > OVER_TEMP) {
sound_alarm();
shut_down();
}
..... other thing ....
}
-Pdp
----------
> From: Terry P. Gathright <669@worldnet.att.net>
> To: handyboard@media.mit.edu
> Subject: average_sensor
> Date: Saturday, November 01, 1997 1:19 PM
>
> Could someone please show me how to use this function by example, It
> will load but I don't know what to ask when trying to use.
> This example is on page 22 of the IC manual for the handy board.
> Thanks in advance. Terry Gathright
>
> void average_sensor(int port, int *result)
> {
>
> int sum= 0;
> int i;
>
>
> for (i= 0; i< 10; i++) sum += analog(port);
>
>
> *result= sum/10;
>
> }
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|