So when you say send it to signalK do you mean 10.10.10.1:3000 ("hostip":3000) then? I tried that but it will does not work. Is there something wrong in my code I don't get it ? (your code is pretty similar). Is there a good guide on this somewhere?
I would love to use micropython but I don't fully understand it yet. Could you give a high level overview of what your *.py scripts do?
I see your boot.py points at webrepl and already there I'm lost. If your boot doesn't point at your main.py how does it get executed then? Also, do you use MQTT or UDP? And does it go through the internet or local wifi?
I just want to be able to establish the connections, the programming of the sensors should be easy. I just don't understand how to commination work and have never programmed it before...
Kind Regards,
Peter
I now changed the code to the following:
If I open a terminal on my PI and write:
Then I pickup the message from my client (the ESP32) - so that is working which is great.
Now, why the h*** can I not pick up this message using KPLEX? And how do I send it to signalK? And finally, how do I get it into OpenCPN as a wind measurement?
Kind Regards,
Peter
I would love to use micropython but I don't fully understand it yet. Could you give a high level overview of what your *.py scripts do?
I see your boot.py points at webrepl and already there I'm lost. If your boot doesn't point at your main.py how does it get executed then? Also, do you use MQTT or UDP? And does it go through the internet or local wifi?
I just want to be able to establish the connections, the programming of the sensors should be easy. I just don't understand how to commination work and have never programmed it before...
Kind Regards,
Peter
I now changed the code to the following:
Code:
#include "WiFi.h"
#include "AsyncUDP.h"
const char * ssid = "............";
const char * password = "...................";
AsyncUDP udp;
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("WiFi Failed");
while(1) {
delay(1000);
}
}
if(udp.connect(IPAddress(10,10,10,1), 3333)) {
Serial.println("UDP connected");
udp.onPacket([](AsyncUDPPacket packet) {
Serial.print("UDP Packet Type: ");
Serial.print(packet.isBroadcast()?"Broadcast":packet.isMulticast()?"Multicast":"Unicast");
Serial.print(", From: ");
Serial.print(packet.remoteIP());
Serial.print(":");
Serial.print(packet.remotePort());
Serial.print(", To: ");
Serial.print(packet.localIP());
Serial.print(":");
Serial.print(packet.localPort());
Serial.print(", Length: ");
Serial.print(packet.length());
Serial.print(", Data: ");
Serial.write(packet.data(), packet.length());
Serial.println();
//reply to the client
packet.printf("Got %u bytes of data", packet.length());
});
//Send unicast
udp.print("Hello Server!");
}
}
void loop()
{
delay(5000);
//Send broadcast on port 3333
udp.broadcastTo("this is now working", 3333);
Serial.println("Sending packages....");
}
If I open a terminal on my PI and write:
Code:
netcat -ul 3333
Then I pickup the message from my client (the ESP32) - so that is working which is great.
Now, why the h*** can I not pick up this message using KPLEX? And how do I send it to signalK? And finally, how do I get it into OpenCPN as a wind measurement?
Kind Regards,
Peter