Hi, I use the Linino to handle REST Web Services, and JSON data. These services talk to an API layer, which maps the JSON data to "device level" calls, which my Arduino understands. (Eg replace Timers for Monday, read all timers, etc.)This API layer takes a sequence of bytes (A private command or the Arduino API), wraps it in a frame (SOM BYTE, frame datalen, DATA, EOM, and Checksum) and sends it to the Arduino over the serial port.I have a C++ class (YUNListener) on the Arduino which waits for SOM, parses the data, ensures there's an EOM, and validates the Checksum. So ant comms errors, or other unwanted / unexpected incoming data on the serial bridge are discarded. The C++ class has 2 Virtual methods, which do nothing in the base class, but are designed to be over-ridden in real subclasses. (Eg TimerListener : YUNListener)The methods are: 1. handleCommand( data ) which you can implement, and will be given a correct byte array from incoming commands.2. debug( data ) which will be called at various points in the command parsing process. I use this method to check for an input pin being pulled high, and if it is, I output serial debugging info to an output pin . So I have a cable that connects the output pin to a serial terminal, and straps the other pin high. So I automatically get debug output when I connect the cable to my laptop.Happy to supply the code if anyone is interested.
What do you exactly mean by you disabled tty?Thought tty is required for Bridge.
@arduino:/# oot@ arduino:/# ->test=[[1,2],[3,4]]sh: -: not found
Quote from: GreyCon on Oct 10, 2013, 04:51 pmHi Wayoda, when you say a BAUD rate of 250000 fails - do you get characters from Serial, or nothing at all? The python script writes 32 chars to the ATmega and then reads 32 bytes with a five second timeout.When used with baudrates above 115200 the read returns unexpected characters and also too few of them.
Hi Wayoda, when you say a BAUD rate of 250000 fails - do you get characters from Serial, or nothing at all?
import serialimport socketTCP_IP = "0.0.0.0"TCP_PORT = 5454serial_conn = serial.Serial("/dev/ttyATH0", 115200, timeout=1)server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)server_sock.bind((TCP_IP, TCP_PORT))server_sock.listen(1)while True: print "Waiting for connection..." conn, addr = server_sock.accept() print "Client " + str(addr) + " connected." serial_conn.flushOutput() serial_conn.flushInput() try: while True: text = serial_conn.readline() print "Sending: " + text conn.send(text) except socket.error as e: print e finally: conn.close()