week_12
Interface and Application Programming
I used the program of Arduino to call the serial port in MATLAB to read the data, and I needed to use serial object in MATLAB.
But there is a problem which is "A timeout occurred before the Terminator was reached".
Later, I found that the data I output in the serial port has English letters, which cannot be used for picture drawing. So I got rid of the code"So I got rid of the code",But it didn't work. So i serach in the interner. I found that i cannot write the code" Serial.print(cm);". I need to write the code "Serial.println(cm)". Then it worked.
Interfacing serial port with MATLAB is also quite simple: If your device is connected to port COM3, this is the code that reads the port into 256byte buffer and selects the maximum value. Then the script starts to update the plot figure by adding a new value every time new value is ready. This is a way to collect longer period of history data from a sensor.
Then I run the program, here is the movie:
I visit the processing.org website download and installed it. I read and watched different tutorials for understanding how to do my assignment. I got a lot of information at www.processing.org website.
I started doing my weekly assignment, I took hall sensor board from week_09, hello.light.45 board. The resulting code looks like this.
Here is the Movie, you can see how it worked.