Beispiel #1
0
// Callback function for the dynamic variable ~pot(num)~. Anytime the browser
// asks for ~pot(num)~, this function is executed.
void HTTPPrint_pot(WORD num)
{
	BYTE AN0String[8];
	WORD ADval;

	// Analog values reading according to the webpage request.
	switch(num)
	{
		case 0:
			ADval = ADCVal(1);
			uitoa(ADval, (BYTE*)AN0String);
			break;
		case 1:
			ADval = ADCVal(2);
			uitoa(ADval, (BYTE*)AN0String);
			break;	
	}

	// After the analog value is read, it is sent to the webpage
	// using the function TCPPutString. sktHTTP is the standard
	// socket for the HTTP communication.
   	TCPPutString(sktHTTP, AN0String);
}
Beispiel #2
0
Datei: aio.c Projekt: r4m/himood
static float Ani_getani (void * _self)
{
	struct Ani *self = _self;
	int ret = ADCVal(self->inter->port->Pin1);
	return (float) ret;
}	
static float An_i_getan_i (void * _self,va_list *app)
{
	struct An_i *self = _self;
	int ret = ADCVal(self->inter->port->Pin1);
	return (float) ret;
}