Skip to content

Commit 1842cc6

Browse files
committed
Fix: use tx_packet_cnt as test data and fix error in printing the wrong data.
1 parent 3e55b58 commit 1842cc6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: examples/UDP_Client/UDP_Client.ino

+8-3
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,25 @@ void loop()
132132

133133
if ((now - prev_udp_packet_sent) > 1000)
134134
{
135+
static int tx_packet_cnt = 0;
136+
135137
prev_udp_packet_sent = now;
136138

137-
/* Send a UDP packet to the UDP server. */
138-
int const tx_packet_size = snprintf((char *)udp_tx_msg_buf, sizeof(udp_tx_msg_buf), "%ld: hello server", millis());
139+
/* Prepare UDP packet. */
140+
int const tx_packet_size = snprintf((char *)udp_tx_msg_buf, sizeof(udp_tx_msg_buf), "Single-Pair Ethernet / 10BASE-T1S: packet cnt = %d", tx_packet_cnt);
139141

142+
/* Send a UDP packet to the UDP server. */
140143
tc6_inst->beginPacket(UDP_SERVER_IP_ADDR, UDP_SERVER_PORT);
141144
tc6_inst->write(udp_tx_msg_buf, tx_packet_size);
142145
tc6_inst->endPacket();
143146

144147
Serial.print("[");
145148
Serial.print(millis());
146149
Serial.print("] UDP_Client sending: \"");
147-
Serial.print(reinterpret_cast<char *>(udp_rx_msg_buf));
150+
Serial.print(reinterpret_cast<char *>(udp_tx_msg_buf));
148151
Serial.println("\"");
152+
153+
tx_packet_cnt++;
149154
}
150155

151156
/* Check for incoming UDP packets. */

0 commit comments

Comments
 (0)