Hi
I am creating an occupancy detection system using mbed. What i have to do is to have to separate threads one for occupancy detection and the other for receiving data from the base station. below is the code of my main function and thread function.
void recv_thread(void const *args)
{
while (true) {
pc.printf("In thread function\r\n");
RxData_RF();
Thread::wait(200);
Thread::yield();
}
}
Thread which is receiving the data from the base station and other nodes////
i want to have the occupancy information calculated in parallel and transmitted//
Main Function(thread) //
int main()
{
spi.format(8,0);
spi.frequency(1000000);
reset();
init_CC2500();
Thread thread(recv_thread);
while(1)
{
occ=getoccupancy(); function that reads values of different sensors and calculate occupancy.
occcheck();
gettemp();
makepack();
pc.printf("transmitting data \r\n");
TxData_RF(datatosend); transmitting the data across to base station
Thread::wait(200);
}
}
My main() thread 1 or two times and does not run after that .. what can the problem be ?
Hi
I am creating an occupancy detection system using mbed. What i have to do is to have to separate threads one for occupancy detection and the other for receiving data from the base station. below is the code of my main function and thread function.
void recv_thread(void const *args) { while (true) {
pc.printf("In thread function\r\n"); RxData_RF();
Thread::wait(200); Thread::yield();
} } Thread which is receiving the data from the base station and other nodes////
i want to have the occupancy information calculated in parallel and transmitted//
Main Function(thread) //
int main() {
spi.format(8,0); spi.frequency(1000000); reset(); init_CC2500();
Thread thread(recv_thread);
while(1) {
occ=getoccupancy(); function that reads values of different sensors and calculate occupancy. occcheck(); gettemp(); makepack(); pc.printf("transmitting data \r\n"); TxData_RF(datatosend); transmitting the data across to base station Thread::wait(200); }
}
My main() thread 1 or two times and does not run after that .. what can the problem be ?