If you read this code in conjunction with the document I translated earlier, the effect would be better. I hope you can give more advice on the incorrect comments.
/*************************************** **************************************** * *** For a detailed explanation of the wireless lighting experiment code, refer to the experiment on wireless lighting in ZigBee practice: step 1: Find the following content, comment out applight ();, and download it to the launch module. Appswitch (); // The node is the key S1 p0_4 // applight (); // The node is the indicator led1 p1_0. Step 2: locate the same position. Comment out appswitch () this time, download to the receiving module. // Restart witch (); // The node is the key S1 p0_4 applight (); // The node is the indicator led1 p1_0. After the data is burned, press the S1 button of the launch module, we can see that the led1 of the receiving module is lit. **************************************** **************************************** * Filename: light_switch.c Description: This application function either as a light or a switch toggling the ligh. the role of the application is chosen in the menu with the joystick at initialisation. push S1 to enter the menu. choose either switch or light and confirm choice with S1. joystick up: sends data from switc H To light ************************************* **************************************** ******//******************************** **************************************** * ************ includes */# include