Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:40 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 Questions ESP01

     Page 2 of 2    
Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 03:30pm 28 Oct 2024
Copy link to clipboard 
Print this post

Here's an ESP32-C3Supermini flashed with Annex receiving serial messages from the PC and sending the message along to the PC via UDP, and also receiving UDP messages from the PC and passing them along to the PC via serial:



' passthru.bas
port=54321
serial2.mode 9600,8,7
udp.begin port
onUDP UDPRx
onSerial2 SerRx
wait

UDPRx:
 pause 500
 msg$=udp.read$
 udp.reply "ACK "+msg$ ' optional reply
 print2 msg$
 wlog "UDP msg: "+msg$
 return

SerRx:
 pause 500 ' allow time for Rx to arrive
 msg$=serial2.input$
 if msg$<>"" then
   udp.write "192.168.2.237", port, msg$
   wlog "serial msg: "+msg$
 endif
 return


On the PC, the lower right window is TeraTerm, from which serial data is sent to and received from the ESP. The upper right window shows the command for sending a UDP message from the "DOS prompt". The middle right window shows a "DOS" UDP listener.

The PC is a stand-in for a PicoMite or CMM2 or any other micro which does not have net connectivity.

The UDP sender optionally gets an "ACK" back. The serial sender could also (but doesn't in this program).

SERIAL2 is used instead of SERIAL so that system messages are not injected.

Of course, there is a world of additional things Annex can do for that device (including telling it what the date and time is.)
Edited 2024-10-29 01:32 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024