Sketch with Arduino

We needed to add the code for the Arduino to work in processing with the capacitive sensor. For this to work, we had to import the arduino library into processing, this was done at the very top of the sketch.

Screen Shot 2016-03-28 at 12.47.27 p.m..png

Also outside the sketch, we had to declare the integers for the arduino.

Screen Shot 2016-03-28 at 12.48.14 p.m..png

The serial myPort is a function, and the code for the function is written outside the setup and the draw at the bottom of the sketch.

Screen Shot 2016-03-28 at 1.11.37 p.m..png

The sensInput had to be declared and set at zero.

Screen Shot 2016-03-28 at 12.49.25 p.m..png

Included in the setup we used this code, and the number [5] could change, and the number is found in the bottom of the sketch, the number could be different depending on which port was used.

Screen Shot 2016-03-28 at 12.50.46 p.m..png

The delay in the code was commented out in order to allow for the capacitive sensor to affect the delay of the tweets/images instead. This was done by creating a float, and using the map to change the numbers to represent another set of numbers that would match the readings from the capacitive sensor.

Screen Shot 2016-03-28 at 12.53.05 p.m..png

In order to get the map readings to know the values we wanted to mirror, we had to open the code in Arduino and run the serial monitor to display the readings in numbers of the currents passing through the sensor. As it changed each time depending on the set up, we will have to change and test the numbers prior to the assessment day as the values could change once we are in the room and set up.

As the first value had to be more than one to accurately represent the readings, and error code appeared stating the value was negative. In order to fix this, we created a new float to constrain the values so that they couldn’t go past the numbers. The newInput had to then be changed from sensInput to the constrain. The numbers in constrain had to match the numbers in map in order for it to run correctly.

Screen Shot 2016-04-04 at 9.44.02 p.m..png



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s