serial-port

Sending commands from a PC to an Android phone - via physical connection (USB, Serial, etc)

心已入冬 提交于 2019-12-20 14:16:27
问题 I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth data, etc) on an Android phone from a PC. Basically the PC will send a notifier to the phone and an app or something on the phone would then process the notifier and do 'something'. The opposite of this really: http://code.google.com/p/android-notifier/ I've seen some examples showing how to send commands to an Android listener app or service via a network connection, but in this case, I

Access USB serial ports using Python and pyserial

浪子不回头ぞ 提交于 2019-12-20 12:16:51
问题 How do I access the USB port using pyserial? I have seen an example with: import serial ser = serial.Serial('/dev/ttyUSB0') I used to access the serial port from MATLAB on Windows and using the appropriate syntax, /dev/ttyUSB0 would be replaced by COM1 or any other COM port. I'm on a Mac and I tried using the serial port scanners on the pyserial documentation to no avail. I think I should write it like this: import serial name = ? # Names of serial ports on Mac OS X ser = serial.Serial(name)

Access USB serial ports using Python and pyserial

我的未来我决定 提交于 2019-12-20 12:16:45
问题 How do I access the USB port using pyserial? I have seen an example with: import serial ser = serial.Serial('/dev/ttyUSB0') I used to access the serial port from MATLAB on Windows and using the appropriate syntax, /dev/ttyUSB0 would be replaced by COM1 or any other COM port. I'm on a Mac and I tried using the serial port scanners on the pyserial documentation to no avail. I think I should write it like this: import serial name = ? # Names of serial ports on Mac OS X ser = serial.Serial(name)

Mac Command Line - List Available Serial Ports?

余生颓废 提交于 2019-12-20 08:37:04
问题 on my Mac, i currently have the available serial ports: /dev/tty.usbserial-A700dYoR /dev/cu.usbserial-A700dYoR /dev/tty.Bluetooth-PDA-Sync /dev/cu.Bluetooth-PDA-Sync /dev/tty.Bluetooth-Modem /dev/cu.Bluetooth-Modem is it possible to retrieve a list of the available serial ports of the computer from the command line (terminal)? 回答1: ah... it is much easier than i though. ls /dev/tty.* ls /dev/cu.* will list /dev/tty.usbserial-A700dYoR /dev/tty.Bluetooth-PDA-Sync /dev/tty.Bluetooth-Modem /dev

How to find out which USB-RS232 device is on which tty?

泪湿孤枕 提交于 2019-12-20 08:27:43
问题 I have two different USB devices based on the same USB-RS232 chips. When I plug those in the USB they are mounted to /dev/ttyUSB0...3 My problem is how, inside a script, I can find out which one is on what tty? Using lsusb I can differentiate them: $> lsusb | grep 0403:f850 Bus 004 Device 002: ID 0403:f850 Future Technology Devices International, Ltd $> lsusb | grep 0403:6001 Bus 004 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC And using

How do I send 0xff byte across a serial port in C?

痴心易碎 提交于 2019-12-20 07:59:04
问题 So I would like to send a 0xff byte across a serial cable which triggers a computer to send back data via an Ethernet cable . The code is as follows #include <stdio.h> #include <stdlib.h> #include<windows.h> #include<winsock2.h> #include <string.h> #include <time.h> #pragma comment(lib,"ws2_32.lib") //Winsock Library #define BUFLEN 4097 //Max length of buffer #define PORT 9090 //The port on which to listen for incoming data int main() { BOOL Status; HANDLE ComPort; char str[20] = "\\\\.\\COM"

Why does the serial BT data I received get chopped out?

喜夏-厌秋 提交于 2019-12-20 07:18:53
问题 The data i receive from a BT serial connection should be: 0 1 2 3 . . . 27 28 29 0 1 2 3 . . . etc But what i actually get are some of the data are chopped out. Like this: 11 12 1 3 14 15 1 6 1 7 18 19 2 0 In the BTSerialService.java /** * This thread runs during a connection with a remote device. * It handles all incoming and outgoing transmissions. */ private class ConnectedThread extends Thread { private final BluetoothSocket mmSocket; private final InputStream mmInStream; private final

readAll() from QSerialPort doesn't include the last response sent

霸气de小男生 提交于 2019-12-20 05:45:38
问题 I'm using Qt to control a serial device. If I send a command to my serial device, I do something like serial->write("command \r\n") . I made a push button which changes the text inside a plain text widget to the response of the serial port. To get the response of the serial port, I'm using serial->readAll() . The problem is it shows the 2nd to last response rather than the one I was expecting. Does Qt have some sort of buffer which is keeping hold of this response? EDIT I botched it by using

Python - read from the serial port data line by line into a list when available

时光毁灭记忆、已成空白 提交于 2019-12-20 05:16:33
问题 I am aiming to write a code that will be indefinitely listening and reading from to a serial port that will have this output produced every few seconds serial port output: aaaa::abcd:0:0:0 //printf("%d\n",data[0]); 2387 //printf("%d\n",data[1]); 14 -9 244 -44 108 I want the data to be appended in a list like this, python supposed output [abcd::abcd:0:0:0, 2387, 14, -9, 244, -44, 108] I tried this code amongst many others but nothing worked, I keep on getting no output EDIT- the code below

How to read data from a serial (SPI) connection in C?

穿精又带淫゛_ 提交于 2019-12-20 04:45:09
问题 I am trying to write a program that will be installed on a Linux MCU (Raspberry Pi) that will read serial data coming to it from yet another MCU (something homegrown that I will build myself). I have researched how to do this and think I have the "big picture" but still missing a few things. For one, I need to enable the kernel module and give myself access to the device: sudo modprobe spi_bcm2708 sudo chown `id -u`.`id -g` /dev/spidev0.* From there I can use this famous C file to test the