#include<TWELITE>#include<NWK_SIMPLE>voidsetup() { ...auto&& nwksmpl =the_twelite.network.use<NWK_SIMPLE>(); nwksmpl << NWK_SIMPLE::logical_id(0xFE) // set Logical ID. (0xFE means a child device with no ID)<< NWK_SIMPLE::repeat_max(3); // can repeat a packet up to three times.}voidloop() { ...vTransmit(); ...}voidvTransmit() {if (auto&& pkt =the_twelite.network.use<NWK_SIMPLE>().prepare_tx_packet(); pkt <<tx_addr(0x00) // to parent <<tx_retry(0x3); // set retrypack_bytes(pkt.get_payload() // prepare payload data,uint8_t(0x01),uint16_t(analogRead(PIN_ANALOGUE::A1)),uint16_t(analogRead_mv(PIN_ANALOGUE::VCC)));pkt.transmit(); // transmit!}
#include<TWELITE>#include<PAL_AMB>// include the board support of PAL_AMBvoidsetup() {auto&& brd =the_twelite.board.use<PAL_AMB>(); // use PAL AMBuint8_t u8dip =brd.get_DIP_SW(); // check DIP s/w statusbrd.set_led(LED_TIMER::BLINK,100); // LED switchs on/off every 100ms ... // start capture of sensorsbrd.sns_SHTC3.begin();}voidloop() {if (TickTime.available()) { // check every msauto&& brd =the_twelite.board.use<PAL_AMB>();if (brd.sns_LTR308ALS.available()) { Serial <<brd.sns_SHTC3..get_temp(); } else { // notify sensor that 1ms passed.brd.sns_SHTC3.process_ev(E_EVENT_TICK_TIMER); } }}