Last active
July 6, 2020 15:45
-
-
Save aattk/4b8b5d493908e2810d83d3d1d336ebdf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| from lib_nrf24 import NRF24 | |
| import spidev | |
| from time import sleep | |
| pipes = [[0xF0,0xF0,0xF0,0xF0,0xE1]] | |
| radio = NRF24(GPIO,spidev.SpiDev()) | |
| radio.begin(0,17) | |
| radio.setPayloadSize(32) | |
| radio.setChannel(0x76) | |
| radio.setDataRate(NRF24.BR_1MBPS) | |
| radio.setPALevel(NRF24.PA_MIN) | |
| radio.setAutoAck(True) | |
| radio.enableDynamicPayloads() | |
| radio.enableAckPayload() | |
| radio.openReadingPipe(1,pipes[0]) | |
| radio.printDetails() | |
| radio.startListening() | |
| while True: | |
| while not radio.available(0): | |
| sleep(1/100) | |
| print("Dur") | |
| alinan = [] | |
| radio.read(alinan,radio.getDynamicPayloadSize()) | |
| print("Alinan : {}".format(alinan)) | |
| veri = "" | |
| for i in alinan: | |
| if (i>=32 and i<=126): | |
| veri += chr(i) | |
| print("Veri : {}".format(veri)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment