But there is a simple problem, which is that the signal has a short distance, so I decided to use NRF24L01 , but unfortunately I cannot write the code for it. Can anyone help me?
Start with Robin2's excellent simple rf24 tutorial if you want to use the rf24 radios. >> Simple nRF24L01+ 2.4GHz transceiver demo If you follow the tutorial, closely, you should have success.
I have used the RF24 modules for years. But they seem to be very difficult for some to use. They are finicky about power and use several pins. The HC12 use only 2 pins (a serial port, hardware or software).