labs for class 5

In this two labs we could see processing software interact with the Arduino chip.

SERIAL OUTPUT FROM AN ARDUINO

Here are the values of the potentiometer displayed on CoolTerm software (be sure to close the monitor in arduino)

coolterm reading data

Then we use serial library in processing and add the port name to the code between “”

processing y arduino

Finally we have the picture of the program showing the increase of the potentiometer.

line draw with potentiometer

DUPLEX SERIAL COMMUNICATION WITH ARDUINO

Here we use an accelerometer and a switch as the inputs for the arduino (2 analog and one digital ).

PUNCTUATION METHOD

By the following picture we can see the program and the monitor screen, where we’re receiving the 3 sensors info, accelerometer x and y , and the switch status (0 = OFF, 1 = ON)

Be sure to check the range of the accelerometer you use, so then you can map the x and y position with the correct range.

3 sensores

When adding the program in processing, if a variable is declare in a ïf” statement, be sure that when the variable is used (as in the for loop) is inserted inside the {} of the ïf”statement.

The program run ok, only sometimes i had the following error, that was solve if I save the code and run it again.error

After the punctuation method we did the Hand n’shake where you have to pay attention that some variable  (sensor names) are not the same as the program you already have so just do the little changes.

In the next picture you can see that arduino stops writing “hello” after receiving a signal.

hand shake arduino

Here is the link to the ball controlled with the circuit (I decide to increase the size of the ball)

 

1 Response

  1. These are great! Thank you so much for documenting the serial labs and more than anything for adding comments of things to catch while you work with serial! Great job. B_

Leave a Reply