To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 4117
4116  |  4118
Subject: 
Re: check_sensors.c
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Sat, 4 Jul 1998 13:15:59 GMT
Original-From: 
David Kott <DAKOTT@ALPHA.spamcakeDELTA.EDU>
Viewed: 
3520 times
  
On Fri, 3 Jul 1998, Terry Garthright wrote:

> 
> /* GLOBALS*/
> 
> int num_sensors =6 /* put the number of analog sensor inputs you want*/

All C declarations must be terminated with a semicolon.  Try :

int num_sensors = 6;
                   ^

> 
> void main()
> 
> {
> 
> int sensors[num_sensors];
> 
> int counter;
> 
> while


is this legal syntax for "while"?  Try:

while (1)

> {
> 
> counter = 0;
> 
> while (counter < num_sensors)
> 
> {
> 
> sensors[counter] = analog(counter);
> 
> printf("%d",sensors [counter] );
> 
> counter++;
> 
> }
> 
> printf("/n");
> 
> sleep(.5);
> 
> }
> 
> }
> 
> 

If you just wanted to print out the analog sensor value, do you really
want to dump them into an array?

void main() {
int iIndex;

   while (1) {
     for (iIndex=0; iIndex <= 6 ; iIndex++) {
        printf("%d",analog(iIndex));
     }
  printf("\n");
  msleep(500L);
}


I think my IC skills are a bit rusty;  there may be errors in my
implementation.

-d
The box said "Requires Windows 95/NT or better"...
                                                 So I got Unix.

Free the Source.  Free your Computer... http://www.FreeBSD.org
                                          http://www.NetBSD.org
                                            http://www.OpenBSD.org



Message is in Reply To:
  check_sensors.c
 
Hello All, I would like to write code for the handyboard to constantly monitor inputs. I copied this this code from the mail arcives 3-22-97, whats wrong?? Thanks in Advance Terry Gathright 669@worldnet.att.net /* GLOBALS*/ int num_sensors =6 /* put (...) (28 years ago, 3-Jul-98, to lugnet.robotics.handyboard)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR