Our Pachinko Machine was very successful at the children’s museum. Many people ended up trying out the machine, and a dad even lifted his girl on top of a table so she could insert the disks into the machine. On average, people interacted with the machine for about a minute. What seemed to interest the children the most was the peg attached to the servo and how accessible it was.
For our next attempt at this machine, we intend to make it more clear where to put the disks, include a mechanism that makes the speed at which the disks insert the machine dependent upon the user’s input, and lastly, make the servo peg flush with board. We are also considering including a gambling aspect to our project.
Code:
#include <Servo.h> const int speaker = 3; //Mosfet pin const int pr1 = A0; const int pr2 = A1; const int sw1 = A2; const int sw2 = A3; const int sw3 = A4; Servo serv; //What we want: //If no puck or slot 2, servo nuetral //If puck in slot 1, servo blocks slot one path //If puck in slot , servo blocks slot three path //If int block1 = 0; int neutral = 90; int block3 = 180; int delayt = 800; int delays = 1200; void setup() { // put your setup code here, to run once: pinMode(speaker,OUTPUT); pinMode(pr1, INPUT); pinMode(pr2, INPUT); serv.attach(8); Serial.begin(9600); while (! Serial); Serial.println("BEGIN"); } void loop() { noTone(speaker); if (analogRead(pr1) < 250){ serv.write(block1); delay(delays); //tone(speaker,300); //Serial.println(analogRead(pr); } else if (digitalRead(pr2) == LOW){ serv.write(block3); delay(delays); //Serial.println("covered2"); } else{ serv.write(neutral); } if (digitalRead(sw1) == LOW){ tone(speaker,2000); delay(delayt); } if (digitalRead(sw2) == LOW){ tone(speaker,2500); delay(delayt); } if (digitalRead(sw3) == LOW){ tone(speaker,3000); delay(delayt); } }
Leave a Reply
You must be logged in to post a comment.