Through a wifi connection and using the OSC protocol, I need to be able to change dynamicaly a 8x8 ledmatrix (the one produced by friedcircuits). The led matrix controller refer to an array named "un" in the following shared code (you won't see the portion related to driving the ledmatrix since it does works well on that side).
The OSC transmission/reception/parsing of the message, which is compose of 8 independant strings parse in my program, works well. Printing result give exactly with is sent to it.
B00000000
B11111111
B10101010
B00000000
B11111111
B10101010
B00000000
Problem occur when I try to get those to replace the ones in the array "un".
" m.getArgAsString(j).getBytes(un[j], 7) "
gets me this error :
"invalid conversion from 'byte {aka unsigned char}' to 'unsigned char*' [-fpermissive]"
Thanks for your bright light on this.
#include <ArduinoOSC.h>
WiFiUDP udp;
ArduinoOSCWiFi osc;
const char* ssid = "Blablabiti";
const char* pwd = "Zind@b@d";
const IPAddress ip(10, 0, 1, 9);
const IPAddress gateway(10, 0, 1, 1);
const IPAddress subnet(255, 255, 255, 0);
const char* host = "10.0.1.3";
const int recv_port = 9999;
const int send_port = 8888;
byte un[8] = {
B00000000,
B11111111,
B00000000,
B11111111,
B00000000,
B11111111,
B00000000,
B11111111};
void setup()
{
Serial.begin(115200);
WiFi.disconnect(true);
WiFi.begin(ssid, pwd);
WiFi.config(ip, gateway, subnet);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
osc.begin(udp, recv_port);
osc.addCallback("/ard", &transfert);
}
void loop()
{
osc.parse();
}
void transfert(OSCMessage& m) // receive through OSC (on wifi conncetion) a message with 8 strings
{
for (int i=0;i<8;i++) // loop through all the 8 string received in the OSC message
{
Serial.print(m.getArgAsString(i)); // print them. all good.
Serial.println("");
}
for (int j=0;j<8;j++) // loop through all the 8 string received in the OSC message
{
m.getArgAsString(j).getBytes(un[j], 8); // get each stings to replace the 8 members in the array "un"
Serial.println(un[j]);
Serial.println("");
}
delay(100);
}