Is it possible to send data through USB with CyberPi?


#1

Hi everyone, I would like to have guidance on this task

I have this code that is working fine, it prints on the screen of the lcd my value. My need is to make the Cyberpi comunicate via Bluetooth or USB to an application that read the COM4 of the cyberpi. Is it that possible? I allready make a python code that is running on my pc and do exactly the same thing, but I would like the cyberpi to have a standalone program that sends data, and another program to acquire data.

Is it possible? Thanks for your time reading till here.

import event, time, cyberpi

@event.start
def on_start():

cyberpi.display.show_label("Motion-sensing", 16, "top_mid")
cyberpi.table.add(1, 1, "Pitch angle")
cyberpi.table.add(2, 1, "Roll angle")
cyberpi.table.add(3, 1, "Yaw Angle")

while True:
    pitch = cyberpi.get_pitch()
    roll = cyberpi.get_roll()
    yaw = cyberpi.get_yaw()
    
    # Update the table on CyberPi display
    cyberpi.table.add(1, 2, pitch)
    cyberpi.table.add(2, 2, roll)
    cyberpi.table.add(3, 2, yaw)

#Comunicate with serial the 3 values


#2

It’s possible, look for the Upload Mode Broadcast in the extensions, but you must code in blocks for it to work. The CyberPi doesn’t have bluetooth, only WiFi. Sorry, bit if you are coding via micropython, the extensions won’t work. So it is only possible to send data over USB if you have the block extension.


#3

@Rosco and @IamTheVector

The CyberPi does have Bluetooth, Serial, and Wi-Fi!
It’s technically possible to send data through the USB (and it is just as possible in MicroPython, since that’s what the blocks are based on). It’s easier to do in blocks, but not as customizable as in MicroPython.

I’m not sure how you would do it in Python. I would very much advise using blocks instead, but I can try to look in the Upload Mode Broadcast source code to find some info there for you.