Send Data between EV3 and PC

819 views Asked by At

I am programming a roboter, and it needs to send data between the EV3 and my laptop (Windows) I run pybricks on the EV3, which enables me to code in python.

I already did research, but the only things that are remaining are some blogs from 2014 that don't help either.. the only thing that helped a little was the official documentation of pybrick.

I thought that running the example code on the EV3 and laptop would work, but the code only worked on the EV3. The EV3 waits until getting a message, but the laptop instantly says connected, even tough it isn't.

I thought it is maybe possible to get the laptop to act like an EV3 to connect them (because the original message function for EV3 is only made for interaction between different bricks), but my knowledge kinda ends here, even tough I tried a few things, like a virtual box.. maybe I did something wrong, but I hadn't had good results

1

There are 1 answers

0
James Geddes On

If I understand correctly, you want to,

  1. send a value to a remote machine
  2. have the remote machine do some stuff
  3. get a response from the remote machine

If that is correct, this is normally achieved by API. The remote machine serves an API, which the client calls using the requests library. For example, TheCatAPI allows you to call for pictures of cats. Your laptop and EV3 are still logically distinct, even though they are physically nearby.

You can choose to host the API on your laptop or make it available to others using services like AWS. Avoiding copypasta, Real Python has some fantastic docs on how to build an API.

You will want to connect your EV3 to WiFi then tell it to call your new API. If you set this up in AWS lambda, others will be able to do the same and it will probably be free for you.

If you want to do it purely locally, you will need to connect your EV3 and laptop via Bluetooth and establish a serial link.

Personal opinion

I would suggest that showcasing your ability to create an API and get it working on AWS would be more beneficial than going down the Bluetooth route.