transmit.py 871 B

12345678910111213141516171819202122232425
  1. import logging
  2. import time
  3. import cc1101
  4. logging.basicConfig(level=logging.INFO)
  5. with cc1101.CC1101() as transceiver:
  6. print("defaults:", transceiver)
  7. transceiver.set_base_frequency_hertz(433.5e6)
  8. transceiver.set_symbol_rate_baud(600)
  9. # transceiver.set_sync_mode(cc1101.SyncMode.NO_PREAMBLE_AND_SYNC_WORD)
  10. print(transceiver)
  11. print("state", transceiver.get_marc_state().name)
  12. print("base frequency", transceiver.get_base_frequency_hertz(), "Hz")
  13. print("symbol rate", transceiver.get_symbol_rate_baud(), "Baud")
  14. print("modulation format", transceiver.get_modulation_format().name)
  15. print("starting transmission")
  16. transceiver.transmit(b"\x01\xff\x00 message")
  17. time.sleep(1.0)
  18. transceiver.transmit(bytes([0x01, 0b10101010, 0xFF]))
  19. while True:
  20. time.sleep(1.0)
  21. transceiver.transmit(bytes(range(1, 16)))