Skip to content

Commit 2d652bb

Browse files
authored
Merge pull request #24 from thodob/ultrasound_wifi
Remove Chunking for WiFi Data Transmission
2 parents bc8e410 + 89bfdb6 commit 2d652bb

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

docs/Library/Others.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ Second figure shows measurements with a flat object placed near the board. Here,
307307

308308
Utilizes only one microphone. The example is similar to [Basic_UltraSound]({% link Library/Others.md %}#basic_ultrasound), but uses WiFi as communication medium instead of Serial.
309309

310+
**Step 0**{: .text-blue-000} : Connect an antenna to the Arduino GIGA R1 (provided in the bundle)
311+
312+
<img src="{{site.baseurl}}/assets/images/arduino-antenna-connection.png" alt="drawing" width="507"/>
313+
310314
**Step 1**{: .text-blue-000} : Include SensEdu and WiFi libraries.
311315

312316
```c
546 KB
Loading
Binary file not shown.

libraries/SensEdu/examples/Basic_UltraSound_WiFi/Basic_UltraSound_WiFi.ino

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,9 @@ void handle_error() {
139139
digitalWrite(error_led, LOW);
140140
}
141141

142-
// send data in 32 byte chunks
142+
// send data in a single chunk
143143
void wifi_send_array(const uint8_t* data, size_t size, WiFiClient client) {
144-
const size_t chunk_size = 32;
145-
for (uint32_t i = 0; i < size/chunk_size; i++) {
146-
client.write(data + chunk_size * i, chunk_size);
147-
}
144+
client.write(data, size);
148145
}
149146

150147
void printWifiStatus() {

libraries/SensEdu/examples/Basic_UltraSound_WiFi/matlab/Basic_UltraSound_WiFi_ReadData.m

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,9 @@
4949

5050
%% functions
5151
function data = read_data(arduino_server, data_length)
52-
total_byte_length = data_length * 2; % 2 bytes per sample
53-
serial_rx_data = zeros(1, total_byte_length);
54-
55-
for i = 1:(total_byte_length/32) % 32 byte chunk size
56-
serial_rx_data((32*i - 31):(32*i)) = read(arduino_server, 32, 'uint8');
57-
end
58-
59-
data = double(typecast(uint8(serial_rx_data), 'uint16'));
52+
total_byte_length = data_length * 2; % 2 bytes per sample
53+
serial_rx_data = read(arduino_server, total_byte_length, 'uint8');
54+
data = double(typecast(uint8(serial_rx_data), 'uint16'));
6055
end
6156

6257
function plot_data(data)

0 commit comments

Comments
 (0)