transmit.py 908 B

1234567891011121314151617181920212223242526
  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. # transceiver.disable_checksum()
  11. print(transceiver)
  12. print("state", transceiver.get_marc_state().name)
  13. print("base frequency", transceiver.get_base_frequency_hertz(), "Hz")
  14. print("symbol rate", transceiver.get_symbol_rate_baud(), "Baud")
  15. print("modulation format", transceiver.get_modulation_format().name)
  16. print("starting transmission")
  17. transceiver.transmit(b"\x01\xff\x00 message")
  18. time.sleep(1.0)
  19. transceiver.transmit(bytes([0x01, 0b10101010, 0xFF]))
  20. while True:
  21. time.sleep(1.0)
  22. transceiver.transmit(bytes(range(1, 16)))