Godot and Arduino local WIFI connection

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mike Trevor

Is it possible for Godot apps running in Android to communicate with an Arduino via local wifi?
Or do I need to install 3rd party libraries for that?

I have a school project and I’m trying to create a program an app that gets information from an Arduino device, illustrating a graph of information/data/recordings from the Arduino device itself, and I don’t know where to start. Where should I start?

thank you in advance for responding

:bust_in_silhouette: Reply From: BraindeadBZH

Godot provides network functions so it should be possible.

:bust_in_silhouette: Reply From: Squatnet

I quite succesfully managed to do this with PacketPeerUDP,
I had a rather complex network of arduinos all connected together. One had either wifi / ethernet shield attached (it didnt matter which) and was designated master.
The Master arduino would monitor devices joining / leaving this network and report back to the godot app which devices were connected and allow basic messages to be sent back to the arduinos.
Godot side is very simple, Arduino side was basic UDP listener example.

extends Node
var UdpSocket = PacketPeerUDP.new()
var port = 9000
var ip = "192.168.0.10"
func _process(delta):
	if UdpSocket.get_available_packet_count() > 0:
		var array_bytes = UdpSocket.get_packet()
		print("Server says "+array_bytes.get_string_from_ascii())
func setupUDP():
	if (UdpSocket.listen(port) != OK):
		print("Error listening on port: " + str(port))
	else:
		print("Listening on port: " + str(port))
func sendData(data):
	if UdpSocket.is_listening():
		UdpSocket.set_dest_address(ip, port)
		var pac = data.to_ascii()
		print(pac)
		UdpSocket.put_packet(pac)
		print("send data via UDP! "+data)