3 examples assignment – Aya&Nourhane

EXERCISE 1:

In this exercise, we used a potentiometer to control the movement of a circle in p5.

Here’s the video:

//ARDUINO CODE IS INSIDE THE SKETCH COMMENTED OUT AT THE END

ABOUT THE CODE:

The code allows to control circle on the screen using data received from the Arduino.

EXERCISE 2:

For this exercise, we are controlling the intensity of the LED using the UP, DOWN keyboard keys from a p5 sketch. We added cute clouds in the background and a sun. The LED is also yellow as if the sun is actually rising.

//ARDUINO CODE IS COMMENTED OUT IN THE SKETCH

ABOUT THE CODE:

The brightness of a sun-like circle in the center is controlled using the arrow keys. The sketch also establishes serial communication with Arduino to control the brightness of the LED.

EXERCISE 3:

In this exercise, we have two parts:

-First one is the bouncing of the soccer ball in the p5 sketch controls the ON/OFF state of the LED

-Second one is the ultrasonic sensor controls the position of the soccer ball in the soccer field.

PART 1: LED CONTROLLED BY GRAVITY

PART 2: BALL POSITION CONTROLLED BY ULTRASONIC 

//ARDUINO IS COMMENTED OUT IN SKETCH

ABOUT THE CODE:

For part 1 => The ball’s position affects the behavior of the LED => ON/OFF

For part 2=> Arduino is used to read data from an ultrasonic sensor and control the movement of the ball in the sketch.

 

Leave a Reply