Hey Guys,
im working on this Project, i have a mpu6050-sensor-breakoutboard and i want to send the data via an ethernetshield to touchdesigner where it is processed further. As i need it to be very small (and cheap), i decided to use an nano with an enc28j60-shield.
I wanted to use the UIPEthernet Libary, as it easy to use for me, but the ram usage is very high and my arduino now complains about stability issues.
I only need to send udp-messeges to the pc, is there any way to reduce the load of the libary? or any other ideas for transfering the data? (In the end there will be 50 sensors, with 50 nanos, all sending data to touchdesigner, and also touchdesigner will be sending data to the nanos, which will control each one led with an ws2812-ic.)
#include <MPU6050_tockn.h>
#include <Wire.h>
#include <UIPEthernet.h>
#include <FastLED.h>
//#include <EthernetUdp.h>
byte mac[] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfc
};
IPAddress ip(192, 168, 0, 18);
#define IP "192.168.0.17"
unsigned int localPort = 8888; // local port to listen on
EthernetUDP Udp;
MPU6050 mpu6050(Wire);
void setup() {
Wire.begin();
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
Ethernet.begin(mac, ip);
Udp.begin(localPort);
}
void loop() {
mpu6050.update();
Udp.beginPacket(IP, 8888);
Udp.print("+");
Udp.print(mpu6050.getTemp());
Udp.print("+");
Udp.print(mpu6050.getAngleX());
Udp.print("+");
Udp.print(mpu6050.getAngleY());
Udp.print("+");
Udp.print(mpu6050.getAngleZ());
Udp.print("+");
Udp.print(mpu6050.getAccX());
Udp.print("+");
Udp.print(mpu6050.getAccY());
Udp.print("+");
Udp.print(mpu6050.getAccZ());
// Udp.print("+");
// Udp.print(mpu6050.getGyroAngleX());
// Udp.print("+");
// Udp.print(mpu6050.getGyroAngleY());
// Udp.print("+");
// Udp.print(mpu6050.getGyroAngleZ());
// Udp.print("+");
// Udp.print(mpu6050.getGyroX());
// Udp.print("+");
// Udp.print(mpu6050.getGyroY());
// Udp.print("+");
// Udp.print(mpu6050.getGyroZ());
Udp.endPacket();
delay(10);
}