Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:49 10 Nov 2025 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 : Pi-cromite 5.4.12, UDP messaging support

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 10:19pm 16 Oct 2017
Copy link to clipboard 
Print this post

Please find attached version 5.4.12. This now includes full support for UDP messaging and conversion of internet addresses:

2017-10-17_080857_mmbasic-stretch.zip

2017-10-17_080909_mmbasic-jessie.zip




The picture shows an interaction between a Pi Zero W, running Jessie (top) and, on the bottom, a Pi 3 running stretch

The Pi zero is configured as a UDP server listening on port 6001. It tries to receive a message but there is nothing there (the port number of the client is set to zero and the message itself and the client address are blank strings). The RECEIVE command is non-blocking and always returns immediately.

It tries to send a message but can't because there is no client

The client then sends a message and the server repeats the read command. In this case the message is received and the server reports the message and who sent it. At this point the server knows the address and receive port for the client and can now send a message.

The server sends the message and the client successfully receives it.

Note on the client screen the use of the function GETIP$() to return the IP address for www.thebackshed.com

I'll update the manual later today and post it to this thread


Edited by matherp 2017-10-18
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 11:42pm 16 Oct 2017
Copy link to clipboard 
Print this post

Crikey.....

Please, matherp, NEVER leave these forums.......
Smoke makes things work. When the smoke gets out, it stops!
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 727
Posted: 02:37am 17 Oct 2017
Copy link to clipboard 
Print this post

Cool,


but why do we need two different versions?:

2017-10-17_080857_mmbasic-stretch.zip

2017-10-17_080909_mmbasic-jessie.zip
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 02:40am 17 Oct 2017
Copy link to clipboard 
Print this post

  Quote  but why do we need two different versions?:


I got reports that once I moved to Stretch users were seeing strange errors when running on Jessie based machines
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 727
Posted: 09:44am 17 Oct 2017
Copy link to clipboard 
Print this post

Do you let us know the reason for this behavior and what is the difference in the „code“?

THX
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 11:18am 17 Oct 2017
Copy link to clipboard 
Print this post

  Quote  Do you let us know the reason for this behavior and what is the difference in the „code“?


No idea. The code is the same the only difference is the version of Raspbian running on the build host - may be a different version of GCC?

In any event the executables are different size so there is some sort of difference - just use the version that is relevant to the version of Raspbian on you Pi
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 727
Posted: 07:21pm 17 Oct 2017
Copy link to clipboard 
Print this post

Thanks Peter,
very strange issue.
However, your Baby works and we can communicate via Network.

Very very 😎

Thank you.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 01:27am 18 Oct 2017
Copy link to clipboard 
Print this post

Updated 5.4.12 manual attached:

2017-10-18_112554_Pi-cromite_Manual.pdf
 
Micro-80
Newbie

Joined: 03/03/2017
Location: Russian Federation
Posts: 26
Posted: 05:24am 18 Oct 2017
Copy link to clipboard 
Print this post

Thanks Peter!
This is a wonderful and quickly done job!
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1044
Posted: 11:43pm 18 Oct 2017
Copy link to clipboard 
Print this post

Hi Peter,

I am not sure how hard it is, but would it be possible to call SUBs and Functions from the command line once a program is loaded. It currently thinks all not valid commands are an attempt to load a file. This helps when debugging etc.



Also another small one. The SYSTEM command returns the last line of the output twice from what I am seeing.e.g
SYSTEM "ls -al"
shows the last file twice.

Regards
Gerry

F4 H7FotSF4xGT
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 12:14am 19 Oct 2017
Copy link to clipboard 
Print this post

  Quote  I am not sure how hard it is, but would it be possible to call SUBs and Functions from the command line once a program is loaded.


This appears to be an either/or

We can either be able to execute programs as a single command or execute internal subroutines/functions.

My instinct is to make the change to run internal functions. You can always execute a program from disk with "RUN filename"

Views?

  Quote  The SYSTEM command returns the last line of the output twice from what I am seeing.e.g
SYSTEM "ls -al"


Fixed, will post update once decision on above is confirmed
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1044
Posted: 12:25am 19 Oct 2017
Copy link to clipboard 
Print this post

I like the 'RUN filename' option and the ability to call SUBs and Functions from the command line as part of testing/debugging.

Regards
Gerry
F4 H7FotSF4xGT
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 05:59pm 19 Oct 2017
Copy link to clipboard 
Print this post

Maybe it is nice to add support for MQTT (http://mqtt.org/ ) It is a simple protocol for transmitting messages between controllers.
It is not a UDP but it uses TCP/IP.
The Pi could function as a broker/server or as a client.
Lots of drivers/software etc available on the above website.
Microblocks. Build with logic.
 
bigfix
Senior Member

Joined: 20/02/2014
Location: Austria
Posts: 129
Posted: 11:56pm 22 Oct 2017
Copy link to clipboard 
Print this post

I also think MQTT is one missing piece in the MicroMite Universe
As only the Picromite has real networking - this is the place to ask for it

I would love to have it also available for the plain MicroMites - Net Frontend ?
In ESPterm it is on the ToDo List - but my hopes are limited with just me asking...
ESPTerm Thread


A client implementation is all which is needed
For a server there is Mosquitto and other available solutions

Lot of sensors and actors are on Ebay based on ESP8266 which support MQTT over Wifi
Search for Itead Sonoff - dirt cheap and open source enhanced code is available

Many people seem to use Tasmota as alternative SW for Sonoff Devices
Tasmota GitHub
There you find a pointerlist to all Sonoff devices

Having a MQTT Client integrated in MMbasic would enable very interesting automated home solutions
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 03:39am 23 Oct 2017
Copy link to clipboard 
Print this post

  Quote  I also think MQTT is one missing piece in the MicroMite Universe





This shows the Pi-cromite publishing to a MQTT broker (server) running on a linuxmint virtual machine running under VMware on my PC. The subscribing client is also running on the linuxmint VM

No need for any changes to the Pi-cromite code. Note the use of single quotes for the message


Just install the mosquitto client on the raspberry pi running mmbasic

sudo apt-get install mosquitto-clients
Edited by matherp 2017-10-24
 
bigfix
Senior Member

Joined: 20/02/2014
Location: Austria
Posts: 129
Posted: 04:25am 23 Oct 2017
Copy link to clipboard 
Print this post

My most optimistic guess was that you solve this in less than a week

But I forgot about the power of a real OS & MMbasic hybrid, you created here !

So all the lowlevel stuff like keepalive is handled in the Mosquitto client outside MMbasic - right ?

To get a realtime state of the subscribed topic into MMbasic I need to issue the relevant system commands in regular intervals - basically polling the Mosquitto client ?


Not directly related to MQTT - but to Picromite

Is there any chance/plan that we get a "virtual" display on a webpage, which looks like one of the supported displays in MMbasic with GUI Command support

Maybe even a realtime mirror of an attached physical display
Reading the display bitmap and publishing it as web-picture
Getting Mouse/Touch events "ored" to the real touchscreen
I guess performance may be low, but with a multicore Pi3 ???Edited by bigfix 2017-10-24
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 04:51am 23 Oct 2017
Copy link to clipboard 
Print this post

  Quote  To get a realtime state of the subscribed topic into MMbasic I need to issue the relevant system commands in regular intervals - basically polling them ?


Yes, but I haven't found how to do a non-blocking poll with mosquitto_sub. You can set the count of messages "-C 1" so that it terminates after it sees the first message but there doesn't appear to be a timeout. I assume this is just a limitation of the mosquitto client. Using mmbasic to publish though is trivial as per the example.

  Quote  Is there any chance/plan that we get a "virtual" display on a webpage, which looks like one of the supported displays in MMbasic with GUI Command support


This is sort of do-able now, just save the screen with IMAGE SAVE and then use the HTML server functionality to serve the image to a requesting web-browser as a background. Then position HTML transparent buttons etc over the background in the requisite places. Code the HTML server in MMBasic to respond to the GET requests indicating "GUI" activity. Lots of user code and HTML outside of my competence but do-able
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025