Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   help with programing banner senor. (http://www.chiefdelphi.com/forums/showthread.php?t=31194)

incognito_NICK 11-11-2004 22:53

help with programing banner senor.
 
how do i create a working print statement to see if my banner senors are working? i really have no idea.
(email me if you want to see the code: metalcalibur@gmail.com)

eugenebrooks 11-11-2004 23:14

Quote:

Originally Posted by incognito_NICK
how do i create a working print statement to see if my banner senors are working? i really have no idea.
(email me if you want to see the code: metalcalibur@gmail.com)

First, check that it is working from the indicator lights on the sensor.

After you have done that, and have it wired to a digital input, you have to write code that remembers the prior value and runs the printf() call when it sees the value change. Replace Process_Data_From_Master_uP with the one below, and the two variable declarations:


int old_rc_dig_in10, new_rc_dig_in10;

void Process_Data_From_Master_uP(void) {
Getdata(&rxdata);
if((new_rc_dig_in10 = ((int)rc_dig_in10)) != old_rc_dig_in10) {
printf("rc_dig_in10 = %d\", new_rc_dig_in10);
old_rc_dig_in10 = new_rc_dig_in10;
}
Putdata(&txdata);
}


In the case above, the sensor is wired to digital input 10.
You can generalize this to all of the digital input, RC and OI,
and produce a debugging program for your switches. A
similar thing can be done with analog sensors, but you will
want to add a "sensitivity window" to keep "noise changes"
from causing printf()s galore.

If you want to print the sensor value directly, you must cast
it to an int. printf("%d\n", (int)rc_dig_in10)

Eugene

incognito_NICK 17-11-2004 06:51

Re: help with programing banner senor.
 
thanks for the help. we needed it.


All times are GMT -5. The time now is 02:51.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi