Those disconnections may be due to the Bela program using slightly more.cpu on this board or maybe you have somethinf in there that depends on the state of the analog or digital inputs and so misbehaves with nothing connected?

Press the stop button in the ide in the brief moments it is available. That should stop.the Bela program and stop the disconnections

Thanks for all this help!

Cool, OK so using bela mini card... I stopped Adafruit_TSC2007-OSC running in the background with.....

systemctl stop Adafruit_TSC2007-OSC

I found an earlier version and it seems to work.... and I think I can build up from there. code below....

Still a bit confused/worried why I can't build it up like before. I would love to understand whats going on a bit more so I can debug in the future.

I guess its some interaction between the library, the Dev version, firmware etc. Seems like only you can fix it so sorry about that.


#include "Adafruit_TSC2007.h"
#include <libraries/OscSender/OscSender.h>

// hostAddress should be "localhost" if sending to another application on Bela
// or 192.168.7.1 or 192.168.6.1 if sending to a port on the host computer

// this works and sends to computer when program running as a service
//const char* hostAddress = "192.168.7.1";

// when I try to change to this it still runs but has no effect on the same pd patch. This time on the Bela
const char* hostAddress = "localhost";
//const char* hostAddress = "192.168.7.1";
//int hostPort = 7562;

int hostPort = 57120; // because supercollider is annoying
unsigned int sleepMs = 50; // sleep time between reads


int main()
{
	Adafruit_TSC2007 touch;
	OscSender oscSender(hostPort, hostAddress);
	if (!touch.begin()) {
		fprintf(stderr, "Couldn't find touch controller\n");
		return 1;
	}
	printf("Found touch controller\n");
	printf("Sending to %s:%d\n", hostAddress, hostPort);
	while(1)
	{
		printf("made it to the while loop\n");
		uint16_t x, y, z1, z2;
		if(touch.read_touch(&x, &y, &z1, &z2)) {
			oscSender.newMessage("/tsc");
			oscSender.add(x).add(y).send();
			printf("sending_osc from the if loop\n");
		}
		usleep(sleepMs * 1000);
	}
	return 0;
}

Anyway this is printing nicely so hopefully I am on the path to getting it all running again on this other board.

Thanks

I am very confused. Send me a copy of the code that works please. Download the project as a zip archive and send it to giulio at bela dot io. Also similarly send me a copy of the project that doesn't work