Task 1.
- At first, connecting the breadboard seemed to be the easiest part of the task, however, the uncareful placement of the jump wires did create some problems with Processing later on. Nevertheless, I think the fact that it was hardly identifiable gave a good lesson on how should I approach the task from the start.
- I extremely enjoyed the interaction with the circuit and the Processing as well as the results I was getting. It made me feel like Bob Ross 2.0 which you will, unfortunately, witness when watching the video of me playing with it.
TASK 2.
- My teammate was Nicole
- We did have a successful ball that was bouncing, however it was extremely hard to sync it with servo. We also only had one servo which made us take a different path.
- And this would reflect on the interactivity of the ball, so we thought of basketball like if a player was hitting the ball and the ball was bouncing off of the ground.
- Here’s the video of the final work:
- Arduino code:
/* SendMultipleValues This sketch repeatedly sends a record that contains two values: - The first value is the value of `millis()`, modulo 32768. - The second value is the analog value that is read from pin 9. If you attach a potentiometer to that pin, you can control this value by moving the pot. This sketch pairs well with the RecieveMultipleValues example from the Processing SerialRecord library <https://osteele.github.io/Processing_SerialRecord/>. Things to try: - Connect a second potentiometer to the Arduino, and send the values from both potentiometers. - Send the value from another sensor, such as temperature or proximity. by Oliver Steele, 2020-2022 This example code is in the public domain. */ #include #include "SerialRecord.h" // Change this number to send a different number of values SerialRecord writer(1); Servo myservo; // create servo object to control a servo int pos = 0; void setup() { Serial.begin(9600); myservo.attach(6); } void loop() { int sensorValue = analogRead(6); for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(5); // waits 15ms for the servo to reach the position } for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(5); // waits 15ms for the servo to reach the position } writer[0] = sensorValue; writer.send(); // This delay slows down the loop. This can make it easier to debug the // program. delay(10); } }
Processing code:
float circleY; float xspeed = 4; void setup() { size(500, 500); circleY = 0; } void draw(){ background(0); fill(150); stroke(255); ellipse(height/2 ,circleY ,50,50); circleY = circleY + xspeed; if (circleY > height){ xspeed = -4; } if (circleY< 0){ xspeed = 4; } }