MAS 863: How to Make (Almost) Anything

Serial Communication


This topic incudes:
1) from microcontroller side, how to read and write serial communication
2) from processing side, how to read and write serial communication
3) how to use other platform (python) to read and write serial communication

1.Read and Write Serial Communication from Microconroller in C

In Neil's c code, there are two functions: one is void get_char() for reading character from the serial, the other is void put_char() for sending out character to serial. That's for character communication. I haven't figure out how to send out integer...though

2.Read and Write Serial Communication from Processing

writing serial from Processing to serial, and microcontroller reads the serial in, is a standard processing for software interface to interact with microcontroller. Both integer and character can be sent out directly from Processing. Microcontroller can interpret both integer and character as well. In C code, (int)character is a way to cast the character read in into integer.

Processing code to send and read serial data // send and read both integer and character
c code for microcontroller //send character only, read character only, the the character read can be casted into integer
make file for microcontroller

2.Reading Serial in Phython

Neil gives two source files to read serial in different datatype. is a terminal reading, in all sorts of data format at the same time; is a GUI interface to read data in character format.

< Back to home