Variables in Bridge Program

C, C++, and Visual C++
Post Reply
kaleenee
Fresh meat
Posts: 2
Joined: Fri Jan 27, 2017 12:16 pm
Contact:

Variables in Bridge Program

Post by kaleenee »

Hi!

I'm trying to add in my calibration equation to the example Bridge program code, and am running into some issues.

One, I'm not sure I know where the variable 'lf' comes from. I've figured out that 'd' is the port on the bridge (0-3), and the only thing that 'lf' makes sense as is the voltage output. But it isn't defined anywhere, and if I try and use it in my equation it is underlined in red and hover-over says "identifier 'lf' is undefined"... so how is it using it in the printf?

Maybe I just don't know how the handles are supposed to work...

Any input is super appreciated!
Thanks!

Code: Select all

#define FREQS_SIZE 20
double bridges[FREQS_SIZE] = {0};
int CCONV data(CPhidgetBridgeHandle phid, void *userPtr, int index, double val)
{
	CPhidgetBridgeHandle bridge = (CPhidgetBridgeHandle)phid;
	double f, x, ms;
	int i;

	x = -147.2022*f - 2.1602;

	printf("Load Reading (%d) %lf,\n",index,val);
	/*if(val < 0)
		printf("Data Event (%d) - -0x%06x\n",index,(int)-val);
	else
		printf("Data Event (%d) - +0x%06x\n",index,(int)val);*/

	return 0;
}
frodegill
Fresh meat
Posts: 3
Joined: Thu Mar 04, 2010 2:51 am
Contact:

Re: Variables in Bridge Program

Post by frodegill »

See the printf documentation. %d is a decimal integer, %1f is a floating-point with one decimal. The placeholders are replaced by values from the variables index and val.
kaleenee
Fresh meat
Posts: 2
Joined: Fri Jan 27, 2017 12:16 pm
Contact:

Re: Variables in Bridge Program

Post by kaleenee »

Thank you! Got me pointed in the right direction!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests