So essentially I am running a python script that grabs OSC information from my cellphone, from here I grab this information as
0.6182767748832703
/rotary1/fader3
0.6230342984199524
/rotary1/fader3
Currently, I am printing this information following this idea:
My issue is, that when I check the Serial Monitor, all that I am getting are reverse question marks and sometimes some squares and if I'm lucky a number.
this is also sending indefinitely.
I am going to try to simply return the values, address, and arguments from my OSC instead of printing it. If any of you have any ideas, I will appreciate them a lot.
This is my python code if it helps:
from pythonosc.dispatcher import Dispatcher
from pythonosc.osc_server import BlockingOSCUDPServer
def print_handler(address, *args):
print(f"{address}: {args}")
def default_handler(address, *args):
#print(f"DEFAULT {address}: {args}")
#print(returner(address, *args))
#returner(address, *args)
returnArg(args))
returnAddress(address))
def returner(address, *args):
stri = str(args)
#print( type(address), type(stri) )
def returnAddress(address):
return address
def returnArg(*args):
filter = str(args)
for elem in filter:
if (elem.isdigit() == False):
#print(elem)
if (elem != "."):
filter = filter.replace(elem,"")
#print(filter)
#filter.replace("(", "")
return filter
dispatcher = Dispatcher()
dispatcher.map("/something/*", print_handler)
dispatcher.set_default_handler(default_handler)
ip = "PlaceHolder"
port = 5555
server = BlockingOSCUDPServer((ip, port), dispatcher)
server.serve_forever() # Blocks forever
some parts are removed since they have my IP.
This is my Arduino Code:
#include <Process.h>
void setup() {
// put your setup code here, to run once:
//Make a bridge
Bridge.begin();
//Make a Serial Killer, whoa scary!
Serial.begin(9600);
while (!Serial);
runPython();
}
void loop() {
// put your main code here, to run repeatedly:
}
void runPython() {
Process p; //creation of the proccess
p.runShellCommand("python /C:/Users/ashth/Desktop/test.py");
if (Serial.available() > 0) {
// read the incoming string:
String incomingString = Serial.readString();
//prints the received data
Serial.print("Received");
Serial.println(incomingString);
}
//Serial.flush();
}
Device: Arduino Uno or Elegoo Uno R3
Thanks in advance.