import time from bridges.ftdi.controllers.spi import SpiController from rf.devices.nrf24l01.nrf24l01 import NRF24l01 spidev = SpiController() spi = spidev.SpiDev() radio = NRF24l01(spi=spi) # ======================================== pipes = [[0xe7, 0xe7, 0xe7, 0xe7, 0xe7], [0xc2, 0xc2, 0xc2, 0xc2, 0xc2]] radio.setRetries(15, 15) radio.setPayloadSize(8) radio.setChannel(0x60) radio.setDataRate(NRF24l01.BR_250KBPS) radio.setPALevel(NRF24l01.PA_MAX) radio.setAutoAck(1) radio.openWritingPipe(pipes[0]) radio.openReadingPipe(1, pipes[1]) radio.startListening() radio.stopListening() radio.printDetails() radio.startListening()
import bridges.interfaces.micropython.machine as machine from bridges.ftdi.controllers.spi import SpiController from display_ssd1306_spi import Display ctrl = SpiController() # ctrl = SpiController(product = 'ft2232h', interface = 2) spi = ctrl.get_spi(cs=0, freq=12E6, mode=0) # spi = ctrl.SPI() gpio = ctrl.get_gpio() pin_in = gpio.Pin('ADBUS5', mode=machine.Pin.IN) pin_out = gpio.Pin('ADBUS6', mode=machine.Pin.OUT, value=1) # pin_in = gpio.Pin('BDBUS5', mode = machine.Pin.IN) # pin_out = gpio.Pin('BDBUS6', mode = machine.Pin.OUT, value = 1) print(gpio.pins_values) print(gpio.pins_values_list) def blinks(): from time import sleep def blink(delay=0.2): pin_out.toggle() sleep(delay) pin_out.toggle() sleep(delay) for i in range(3):
from bridges.ftdi.controllers.spi import SpiController from bridges.interfaces.micropython.machine import Pin ctrl = SpiController() machine = ctrl.get_gpio() print(machine.addressable_pins) p0 = machine.Pin('ACBUS5', mode=Pin.OUT) print(p0.value()) p0.value(0) print(p0.value()) p0.value(1) print(p0.value())
import controller from bridges.ftdi.controllers.spi import SpiController ctrl = SpiController() SPI = ctrl.SPI() GPIO = ctrl.GPIO() Pin = GPIO.Pin from bridges.interfaces.micropython.machine import Pin as I_Pin class Controller(controller.Controller): # BOARD config ON_BOARD_LED_PIN_NO = 6 # RPi's on-board LED ON_BOARD_LED_HIGH_IS_ON = True GPIO_PINS = ( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
import controller from bridges.ftdi.controllers.spi import SpiController ctrl = SpiController() SpiDev = ctrl.SpiDev() GPIO = ctrl.GPIO() class Controller(controller.Controller): # BOARD config ON_BOARD_LED_PIN_NO = 6 # RPi's on-board LED ON_BOARD_LED_HIGH_IS_ON = True GPIO_PINS = ( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,