-2

I am in the early stages of a new project, where I have to use Teensy 4.1 to send data to PC via Ethernet, and the PC should write all the received data to a simple text file.

So far I accomplished to find and try a very simple Python code that imitates client-server communication. I created 2 Python files: server.py is opened in the VSCode, the client file is opened in the CMD. The text file is also generated using Python and the data is being written to it during the file transmission.

Now I face the problem, what should I exactly do with the Teensy? I found this promising website:

https://protosupplies.com/learn/prototyping-system-for-teensy-4-1-working-with-ethernet/

After deep examination I changed my IP and other credentials, but it did not work, 192.168.1.100:80 did not bring me to any website at all... Besides, my goal is not a local website exactly, I just need data transfer to PC internally...

Can anyone lead the path for me: what exactly should I be looking on the internet for Teensy? There are some webserver code examples, some UDP code examples and many other examples, but examining everything I find on the internet is too time consuming, besides, I dont really know much of the theory of Ethernet. I guess, the PC should be the server, and the Teensy must be the client, but if it does what I described earlier, there is absolutely no difference for me.

Also can you share any links with a deep explanation and the code itself suitable for my application, provided you know any? I am using Arduino IDE for now, but If you can offer any other framework with libraries I need, it is also acceptable. Thank you in advance.

  • You don't need to know ethernet to use ethernet, you write application to run on top of the ethernet. Ethernet is just a transport media that you use. The Teensy example create a web server that speak HTTP that you can point your browser (i.e. a web client) on your PC or your phone to 192.168.1.100 to see the web page. What you need to do is write your own client on your PC and using http to talk to the web server. Google "http client python" (or any language you want to use) and read [An overview of HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview) as a starter. – hcheung Aug 30 '23 at 13:58
  • But why then I dont see anything when I enter 192.168.1.100:80 to my web browser? It keeps connecting to the site for a while, then the browser shows a timeout error... – Vilius Žalėnas Aug 31 '23 at 16:37
  • I have no idea, basically you didn't show us anything. We can only guess... – hcheung Sep 01 '23 at 01:19

0 Answers0