Radio control: use the Jeti protocol to communicate between a DIY sensor and a Jeti receiver (using 9 bits one wire serial)
main.cpp
- Committer:
- robertspil
- Date:
- 2013-10-29
- Revision:
- 0:32193823db59
File content as of revision 0:32193823db59:
/* main program to communicate between a sensor and a Jeti Duplex receiver Sensor assembly = pcb with processor and sensors processor MBED lpc1768 or LPC11u34 Organization of the program files main.cpp = main program - add here the s core.h = main header file JetiC.cpp = serial communication with jeti depending on the sensors JetiMenu.cpp = Jeti Box menu for the sensor assembly Sensor.h Sensor.cpp = read the physical sensors and compute the measures libraries , provided by external sources, the internet community.. one library for each sensor */ #include "core.h" #include <new> //needed for the nothrow struct instr_data rc; //common sensor data void init() { rc.jetiptr = new(nothrow) JetiC(); // initialize and start the messages to the JetiBox //rc.sensorptr = new(nothrow) Sensor(); } int main() { init(); while(true) { //vey simple scheduler for the sensors if (rc.jetiptr->isAnswer()){ //process the answer from the JetiBox //add here the code to read the sensors //rc.jetiptr->select(); // process the answer code and/or choose a node //rc.jetiptr->display(); //prepare the message for this node rc.jetiptr->debug_display(); //replace the select / display above with a simple debug without any sensor } } }