CC3200 Development Board has a lot of useful hardware.
The easiest way to start is to work with the two on-board sensorsaccelerometer and temperature and then expand to new
sensors and other hardware.
TMP006 InfraredThermopile Sensor in Chip-Scale Package.
BMA222 3-AXIS ACCELEROMETER DIGITAL SMD
The following function deals with HTTP
events. The source code can be downloaded from here. File name is ExositeCC3200CloudDemo-BETA-20140708.zip.
void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pSlHttpServerEvent,
SlHttpServerResponse_t *pSlHttpServerResponse){
....
}
Two events are of a particular interest at this point.
Temperature read:
ptr = pSlHttpServerResponse->ResponseData.token_value.data;
pSlHttpServerResponse->ResponseData.token_value.len = 0;
if(memcmp(pSlHttpServerEvent->EventData.httpTokenName.data,
GET_token_TEMP, strlen((const char *)GET_token_TEMP)) == 0)
{
float fCurrentTemp;
TMP006DrvGetTemp(&fCurrentTemp);
char cTemp = (char)fCurrentTemp;
short sTempLen = itoa(cTemp,(char*)ptr);
ptr[sTempLen++] = ' ';
ptr[sTempLen] = 'F';
pSlHttpServerResponse->ResponseData.token_value.len += sTempLen;
}
Accelerometerread:
if(memcmp(pSlHttpServerEvent->EventData.httpTokenName.data,
GET_token_ACC, strlen((const char *)GET_token_ACC)) == 0)
{
ReadAccSensor();
if(g_ucDryerRunning)
{
strcpy((char*)pSlHttpServerResponse->ResponseData.token_value.data,"Running");
pSlHttpServerResponse->ResponseData.token_value.len += strlen("Running");
}
else
{
strcpy((char*)pSlHttpServerResponse->ResponseData.token_value.data,"Stopped");
pSlHttpServerResponse->ResponseData.token_value.len += strlen("Stopped");
}
}
Both sensors share I2C bus for command and data communications.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.