Portál AbcLinuxu, 27. července 2025 07:16
Dobrý večer. Niesom programátor, a ani moc programovať neviem, skôr len lepím kód. Urobil som wepplayer s Arduinom podľa
tohto. Je tam funkcia, v ktorej je PSTR("/"), ja potrebujem "/" nahradiť premennou ktorá je typu char[]. tu je kód:
void playWebRadioStation ( byte ip[4], const int hisPort, char subor[])
{
player.stopSong();
indexCounter = 0;
ether.copyIp(ether.hisip, ip);
ether.hisport = hisPort;
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
ether.printIp("SRV: ", ether.hisip);
if (strcmp(subor, "") == 0)
{
ether.browseUrl(PSTR("/"), "",PSTR(""), PSTR(""), my_callback);
}
else
{
subor = strcat("/", subor);
ether.browseUrl(PSTR(subor), "",PSTR(""), PSTR(""), my_callback);
}
player.startSong();
}
Hlási mi to chybu:
WebRadio_player.ino:339:20: error: initializer fails to determine size of ‘__c’
WebRadio_player.ino:339:20: error: array must be initialized with a brace-enclosed initializer
Celý deň sa snažím pochopiť čo vlastne robí PSTR(), ale je to na mňa moc. Poraďte prosím...
void playWebRadioStation ( byte ip[4], const int hisPort, char subor[]) { ... ether.browseUrl(subor, "",PSTR(""), PSTR(""), my_callback); } ... playWebRadioStation(...., PSTR("/neco"))
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.