![]() |
send receive TEXT Virtuino6 VirtuinoCN - Printable Version +- Virtuino Forum (https://virtuino.com/forum) +-- Forum: Virtuino (https://virtuino.com/forum/forumdisplay.php?fid=1) +--- Forum: Virtuino 6 (https://virtuino.com/forum/forumdisplay.php?fid=3) +--- Thread: send receive TEXT Virtuino6 VirtuinoCN (/showthread.php?tid=1586) |
send receive TEXT Virtuino6 VirtuinoCN - xmilav - 01-28-2024 Hello, I am doing a project with Arduino Mega2560 and Virtuino6 (version 6.0.34) communication via Bluetooth. I use Serial1 and the VirtuinoCN library. I am interested in passing text strings from Virtuino6 to the Arduino, and from the Arduino to the Virtuino6. Is it not supported? I can't find any example. Can someone show me an example? Thank you. RE: send receive TEXT Virtuino6 VirtuinoCN - iliaslamprou - 01-29-2024 Hi, this is an example for the Ethernet connection. The only you have to do is to change the connection type lines. https://virtuino.com/downloads/examples/virtuinoCM/Ethernet_ex3_send_receive_text.zip On the top of the code declare two Strings: String T0=""; String T1=""; On the void loop do something with the strings: if (T0=="ENABLE PIN 5") digitalWrite(5,HIGH); else if (T0=="DISABLE PIN 5") digitalWrite(5,LOW); T1= "Hello Virtuino "+String(random(100)); Make these changes to the onReceived and onRequested methods Code: void onReceived(char variableType, uint8_t variableIndex, String valueAsText){ Code: if (variableType=='V') { Code: if (variableIndex<V_memory_count) return String(V[variableIndex]); // return the value of the arduino V memory array Code: } Code: else if (variableType=='T') { Code: if (variableIndex==0) return T0; Code: else if (variableIndex==1) return T1; Code: //else if (variableIndex==2) return T2; Code: //else if (variableIndex==3) return T3; Code: } Code: Code: return ""; Code: } RE: send receive TEXT Virtuino6 VirtuinoCN - xmilav - 01-29-2024 Good evening Ilias, thank you for your prompt response. I have already built a program with your comments but in the Virtuino6 APP, when selecting the memory in the "Test value display" field, the "T" option does not appear. I attach screenshots of the mobile. As I said, I use the Virtuino6 Pro 6.0.34 version. Thanks for the help. Xavier. RE: send receive TEXT Virtuino6 VirtuinoCN - xmilav - 02-02-2024 (01-29-2024, 10:00 PM)xmilav Wrote: Good evening Ilias, thank you for your prompt response.Can someone help me understand why I don't see the "T" variable option in the Virtuino6 app? RE: send receive TEXT Virtuino6 VirtuinoCN - iliaslamprou - 02-03-2024 Hi, I sorry for the previous answer. The T variable has been deprecated by Virtuino. You can use the V variable for the text. Please check this conversation: https://virtuino.com/forum/showthread.php?tid=1197 RE: send receive TEXT Virtuino6 VirtuinoCN - xmilav - 02-04-2024 (02-03-2024, 06:17 PM)iliaslamprou Wrote: Hi, I sorry for the previous answer.Perfect Ilias, it has worked for me both to send text from the Arduino to the Virtuino and the other way around. Thank you so much. |