Hi,
first excuse my bad english.
So I have made a small script to recieve data from a Elite Justo and it's kinda working. But I have some problems. I'm using a cheap USB Stick from Amazon
Here is the code:
from openant.easy.node import Node
from openant.easy.channel import Channel
from openant.base.message import Message
NETWORK_KEY = [0xb9, 0xa5, 0x21, 0xfb, 0xbd, 0x72, 0xc3, 0x45] # Standard network key for communication with ANT+ devices
def callback_data_power(data): # This function returns the data as soon as it has been received
print('Leistung ', data) # Example data: array('B', [16, 181, 47, 0, 26, 253, 11, 0]). The value you are looking for (power) should be the penultimate value in the array. Check again
# def callback_data_cadence(data): # This function returns the data as soon as it is received
# print('Cadence ', data)
def main(node):
node.set_network_key(0x00, NETWORK_KEY) # Set the node's network key to the default network for ANT+ devices
### This channel (channel_pmeter) is for transmitting the power
channel_power = node.new_channel(Channel.Type.BIDIRECTIONAL_RECEIVE) # Create a channel for the node to receive data
channel_power.on_broadcast_data = callback_data_power # Execute callback_data when data is received
#channel_power.on_burst_data = callback_data_power # Execute callback_data when data is received
channel_power.set_rf_freq(57) # Set the correct radio frequency of 2.4 Ghz
channel_power.set_id(0, 11, 0) # Establishes the channel between ANT+ dongle and the device with ID 11. To find the desired ID, run "openant scan" in the terminal and search for the device_type of the desired device.
### This channel (channel_cadence) is for the transmission of the cadence
# channel_cadence = node.new_channel(Channel.Type.BIDIRECTIONAL_RECEIVE) # Create a channel for the node to receive data
# channel_cadence.on_broadcast_data = callback_data_cadence # Execute callback_data when data is received
# channel_cadence.set_rf_freq(57) # Set the correct radio frequency of 2.4 Ghz
# channel_cadence.set_id(0, 121, 0)
try:
channel_power.open() # Try to open the channel
# channel_cadence.open()
node.start() # Start the node
finally:
node.stop() #close the channel if connection attempt is unsuccessful
print("Node shut down")
node = Node() # Create a node for the connection of ANT+ dongle and Elite Justo for performance
main(node)
To analyze the problems better, i commented out the second part of the script (see code), but it does the same thing like the first part.
My problem is that I get the message "Could not check if kernel driver was active, not implemented in usb backend" every time I run the Script. And the output of data is regularly interrupted with an error. Are both problems caused by an old driver, did I buy a bad USB Stick or is my code just garbage?
This picture shows the result of some seconds of data recieved, interrupted with the timeout error.
Hi, first excuse my bad english. So I have made a small script to recieve data from a Elite Justo and it's kinda working. But I have some problems. I'm using a cheap USB Stick from Amazon
Here is the code:
To analyze the problems better, i commented out the second part of the script (see code), but it does the same thing like the first part.
My problem is that I get the message "Could not check if kernel driver was active, not implemented in usb backend" every time I run the Script. And the output of data is regularly interrupted with an error. Are both problems caused by an old driver, did I buy a bad USB Stick or is my code just garbage?
This picture shows the result of some seconds of data recieved, interrupted with the timeout error.![Skript Output](https://github.com/Tigge/openant/assets/124708705/9b2639ca-0bf2-49bf-800f-9f7c22be5d71)