-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain
More file actions
42 lines (35 loc) · 1.48 KB
/
main
File metadata and controls
42 lines (35 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
void loop(){
Serial.println("ALL GOOD");
Serial.println("I GOT RED");
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Initialize Packet send
Udp.print("You are Asking for Red"); //Send string back to client
Udp.endPacket(); //Packet has been sent
packetSize = Udp.parsePacket(); //Read theh packetSize
//Check to see if a request is present
if(packetSize>0){
Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE); //Reading the data request on the Udp
String datReq(packetBuffer); //Convert packetBuffer array to string datReq
//See if Red was requested
if (datReq =="Red") {
Serial.println("I GOT RED");
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Initialize Packet send
Udp.print("You are Asking for Red"); //Send string back to client
Udp.endPacket(); //Packet has been sent
}
//See if Green was requested
if (datReq =="Green") {
Serial.println("I GOT GREEN");
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Initialize Packet send
Udp.print("You are Asking for Green"); //Send string back to client
Udp.endPacket(); //Packet has been sent
}
//See if blue was requested
if (datReq =="Blue") {
Serial.println("I GOT AZUL");
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Initialize Packet send
Udp.print("You are Asking for Blue"); //Send string back to client
Udp.endPacket(); //Packet has been sent
}
}
memset(packetBuffer, 0, UDP_TX_PACKET_MAX_SIZE);
}