Hi,
I have Teensy/Arduino and HC-05 bluetooth module. I want to send 30000 number values to PC/Python.
I have this code for Arduino/Teensy. It will send array of 500 (just for testing) numers via bluetooth.
I have Teensy/Arduino and HC-05 bluetooth module. I want to send 30000 number values to PC/Python.
I have this code for Arduino/Teensy. It will send array of 500 (just for testing) numers via bluetooth.
#define BUFFER_SIZE (500) float buf[BUFFER_SIZE]; char inChar; float num; void setup() { Serial.begin(9600); Serial1.begin(9600); } void loop() { if (Serial1.available() > 0) { inChar = Serial1.read();// get incoming byte: for(int i=0; i<BUFFER_SIZE; i++) { buf[i] = i; } Serial1.write((char*)buf, sizeof(buf)); Serial.println( sizeof(buf)); Serial.println("Array sent."); for (int i = 0; i < BUFFER_SIZE; i++) Serial.println(buf[i]); delay(1000); } }This is my Python code. I want to receive array from Teensy/Arduino - but I am no sure how to do it. I just see nonsense numbers.
import bluetooth v_data = [] bd_addr = "FC:A8:9A:00:22:33" port = 1 sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) sock.connect((bd_addr, port)) print('Connected') sock.send("r") print('Sent char to start sending data from Teensy') i = 0 while i < 500: val = sock.recv(1) v_data.append(ord(val)) i += 1 print(v_data)Is any way how to read all array correctly?