最近刚收到2650 sensor tag 开发板,研究了好几天的sensortag实例。
有一个这样的问题:sensortag的实力主要是板子上集成的2个温度传感器,bar,hum,mov传感器的代码。我想要用adc,有没有关于adc的输入外接传感信号的实例。
ti的大婶大大们,求帮助。另外,我是公路车爱好者。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
最近刚收到2650 sensor tag 开发板,研究了好几天的sensortag实例。
有一个这样的问题:sensortag的实力主要是板子上集成的2个温度传感器,bar,hum,mov传感器的代码。我想要用adc,有没有关于adc的输入外接传感信号的实例。
ti的大婶大大们,求帮助。另外,我是公路车爱好者。
这个代码只可以用来测试light sensor,要用ADC还是不行
Fxn函数里面明明写得读的adc数据呀
void taskFxn(UArg a0, UArg a1) {
PIN_Handle hLedPins;
// Enable LED pins
hLedPins = PIN_open(&ledPinState, pLedPinTable);
// Initialize the Sensor Controller
scifOsalInit();
scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
scifInit(&scifDriverSetup);
scifStartRtcTicksNow(0x00010000 / 8);
// Configure and start the Sensor Controller's Analog Light Sensor task (not to be confused with OS tasks)
scifTaskData.analogLightSensor.cfg.hysteresis = 16;
scifTaskData.analogLightSensor.cfg.pBinThresholds[0] = 0;
scifTaskData.analogLightSensor.cfg.pBinThresholds[1] = 400;
scifTaskData.analogLightSensor.cfg.pBinThresholds[2] = 600;
scifTaskData.analogLightSensor.cfg.pBinThresholds[3] = 800;
scifTaskData.analogLightSensor.cfg.pBinThresholds[4] = 1000;
scifTaskData.analogLightSensor.cfg.pBinThresholds[5] = 4095;
scifStartTasksNbl(BV(SCIF_ANALOG_LIGHT_SENSOR_TASK_ID));
// Main loop
while (1) {
// Wait for an ALERT callback
Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);
// Clear the ALERT interrupt source
scifClearAlertIntSource();
// Find the ADC bin value (can access directly since it is a single, single-buffered value, and
// we always want the latest value)
uint16_t bin = scifTaskData.analogLightSensor.output.bin;
// Disable all LEDs and then enable as many as indicated by the current bin
PIN_setOutputValue(hLedPins, Board_LED1, (bin >= 1));
PIN_setOutputValue(hLedPins, Board_LED2, (bin >= 2));
PIN_setOutputValue(hLedPins, Board_LED3, (bin >= 3));
PIN_setOutputValue(hLedPins, Board_LED4, (bin >= 4));
// Acknowledge the alert event
scifAckAlertEvents();
}
} // taskFxn