Code: Select all
SetSensorType(S2, SENSOR_TYPE_CUSTOM);
SetSensorMode(S2, SENSOR_MODE_RAW);
Is there a different "unfaked analog standard sensor / sensor type" by NXC?
Code: Select all
SetSensorType(S2, SENSOR_TYPE_CUSTOM);
SetSensorMode(S2, SENSOR_MODE_RAW);
Code: Select all
cInputSetupCustomSensor(No);
dInputRead0(No, &(IOMapInput.Inputs[No].DigiPinsIn));
dInputRead1(No, &(IOMapInput.Inputs[No].DigiPinsIn));
dInputGetRawAd(&InputVal, No);
IOMapInput.Inputs[No].ADRaw = InputVal;
cInputCalcFullScale(&InputVal, IOMapInput.Inputs[No].CustomZeroOffset, IOMapInput.Inputs[No].CustomPctFullScale, FALSE);
cInputCalcSensorValue( InputVal,
&(IOMapInput.Inputs[No].SensorRaw),
&(IOMapInput.Inputs[No].SensorValue),
&(IOMapInput.Inputs[No].SensorBoolean),
&(VarsInput.InputDebounce[No]),
&(VarsInput.SampleCnt[No]),
&(VarsInput.LastAngle[No]),
&(VarsInput.EdgeCnt[No]),
((IOMapInput.Inputs[No].SensorMode) & SLOPEMASK),
((IOMapInput.Inputs[No].SensorMode) & MODEMASK));
Code: Select all
#define INPUTGetVal(pValues, No) *pValues = (UWORD)IoFromAvr.AdValue[No]; \
*pValues &= 0x03FF
Code: Select all
SetSensorType(S2, SENSOR_TYPE_CUSTOM);
SetSensorMode(S2, SENSOR_MODE_RAW);
int val=SensorRaw(S2)
Code: Select all
#define printf1( _x, _y, _format1, _value1) { \
string sval1 = FormatNum(_format1, _value1); \
TextOut(_x, _y, sval1); \
}
int val1, val2;
task main(){
SetSensorType(S1, SENSOR_TYPE_SOUND_DBA);
SetSensorMode(S1, SENSOR_MODE_RAW);
SetSensor(S2, SENSOR_SOUND);
while(true) {
val1 = SensorValue(S1);
val2 = SensorRaw(S2);
printf1(0, LCD_LINE1, "%5d", val1);
printf1(0, LCD_LINE2, "%5d", val2);
Wait(10);
}
}
Users browsing this forum: No registered users and 0 guests