Quiz Show Controller

10
Quiz Show controller Primary tabs Vi ew(active tab) What links here  published by MRE on Fri, 11/!/!1! " !#$1% &ere is a shot o' the insides o' y ui* show bo+

Transcript of Quiz Show Controller

Page 1: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 1/10

Quiz Show controller

Primary tabs

• View(active tab)

• What links here

 published by MRE on Fri, 11/!/!1! " !#$1%

&ere is a shot o' the insides o' y ui* show bo+

Page 2: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 2/10

-ots o' space in there. he arduino is bolted to the etal base plate he shield is only there to provide a stron0 attachent point 'or the wires n'ortunately, 2 only had solid core bell wire, so

the cablin0 is uite sti'' and hard to work with 3e+t tie 24ll use ribbon cable.

5urried under the wires are two 627 resistor packs he -E8 pack is !9 ohs 2 would have

liked : ohs hey would be uch bri0hter then 5ut 2 didnt have any in y inventory, anddid not want to solder individual resistors ;oon pin on the 627 0oes to 0round 8i0ital

outputs on the <rduino send current throu0h the -E8, then throu0h the 627 resistor pack

he 5uttons are ounted in seperate bo+es hey are typical arcade style 2 was 'ortunate to 'ind

a local shop with % colors Each button has a lon0 cable (at least : eters) so that 2 can use thiskit in a school classroo he player 0roups could be pretty 'ar 'ro the ain bo+

5uttons are tied hi0h with another 627 resistor pack 2n this case, the coon pin on the 627 is

connected to : volts he resistor output is then tied to the analo0 inputs (2 a usin0 the as

di0ital inputs) <lso tied to the input is one le0 o' the switch (via the R;< connector on the bo+)he other end o' the switch is connected to 0round When the switch is open, current 'lows into

the input, re0isterin0 a &2=& value in so'tware When the switch is closed, current takes the path

o' least resistance, 0oin0 stri0ht to 0round, rather than enterin0 the <rduino input pin heso'tware reads this as a ->W condition

2 have space in the bo+ 'or 'uture up0rades 2 plan on installin0 a ?correct? and ?incorrect? button

on the head unit, as well as a reset (so 2 can bypass the : second tier)

2n addition to winner deterination, the so'tware also provides a serial essa0e output 2 hope to

eventually connect it to a 7; and write soe 0aeshow so'tware

Page 3: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 3/10

5elow you will 'ind the <rduino code$

 

/*

  Quiz Show buttons

  Emery Premeaux   <a href="http://www.D!S#i$.or% 

 

"&http://www.D!S#i$.or% 

 

</a& 'his simp(e )uiz show it supports + buttons an, -EDs.

  $uttons shou(, be pu((e, hi%h by resistors an, tie, to 0+.

  -EDs are atta#he, 1ia resistors to ,i%ita( pins 2 throu%h 3.

 

Defau(t #on,ition a(( -EDs are (i%ht 4t he(ps to now power is on 56

  7hen a button is presse, 'hree thin%s happen:

  8: (( -EDs are extin%uishe, an, the winnin% -ED is re(it.

  2: messa%e is sent out the seria( port. 9se it to #ommuni#ate with a P 

%ame if you (ie.  ;: se#on, timer (o#s out a(( other buttons. fter the timer

#omp(etes the -EDs are reset an, buttons

  are rea,y for input a%ain.

 */ 

 

// -ets assi%n names

#define P1LED 2

#define P2LED 3

#define P3LED 4

#define P4LED 5

#define P5LED 6

#define P6LED 7

 

#define P1SW A0

#define P2SW A1

#define P3SW A2

#define P4SW A3

#define P5SW A4

#define P6SW A5

 

int P1, P2, P3, P4, P5, P6;

 

int WinDelay = 5000;

 

// the setup routine runs on#e when you press reset:

void et!"$ % 

// initia(ize the ,i%ita( pin as an output.  "in&odeP1LED, '()P()$; 

"in&odeP2LED, '()P()$; 

"in&odeP3LED, '()P()$; 

"in&odeP4LED, '()P()$; 

"in&odeP5LED, '()P()$; 

"in&odeP6LED, '()P()$;

 

"in&odeP1SW, *+P()$;

  "in&odeP2SW, *+P()$;

Page 4: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 4/10

  "in&odeP3SW, *+P()$;

  "in&odeP4SW, *+P()$;

  "in&odeP5SW, *+P()$;

  "in&odeP6SW, *+P()$;

 

Seial-.e/in600$;

 

// the (oop routine runs o1er an, o1er a%ain fore1er:

void loo"$ %

 LED'n$;

 P1 = di/italeadP1SW$;

 ifP1==0$%

  Win1$;

 

 P2 = di/italeadP2SW$;

 ifP2==0$%

  Win2$;

 

 P3 = di/italeadP3SW$;

 ifP3==0$%  Win3$;

 

 P4 = di/italeadP4SW$;

 ifP4==0$%

  Win4$;

 

 P5 = di/italeadP5SW$;

 ifP5==0$%

  Win5$;

 

 P6 = di/italeadP6SW$;

 ifP6==0$%

  Win6$;

 

 

void Winint Winne$%

 it Winne$%

  ae 1

  LED'ff$;

  di/italWiteP1LED, *8$;

  Seial-"intln9Playe 19$;

  delayWinDelay$;

  LED'n$;

   break;

  ae 2

  LED'ff$;  di/italWiteP2LED, *8$;

  Seial-"intln9Playe 29$;

  delayWinDelay$;

  LED'n$;

   break;

  ae 3

  LED'ff$;

  di/italWiteP3LED, *8$;

  Seial-"intln9Playe 39$;

Page 5: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 5/10

  delayWinDelay$;

  LED'n$;

   break;

  ae 4

  LED'ff$;

  di/italWiteP4LED, *8$;

  Seial-"intln9Playe 49$;

  delayWinDelay$;

  LED'n$;

   break;

  ae 5

  LED'ff$;

  di/italWiteP5LED, *8$;

  Seial-"intln9Playe 59$;

  delayWinDelay$;

  LED'n$;

   break;

  ae 6

  LED'ff$;

  di/italWiteP6LED, *8$;

  Seial-"intln9Playe 69$;  delayWinDelay$;

  LED'n$;

   break;

 

 

void LED'n $%

 di/italWiteP1LED, *8$;

 di/italWiteP2LED, *8$;

 di/italWiteP3LED, *8$;

 di/italWiteP4LED, *8$;

 di/italWiteP5LED, *8$;

 di/italWiteP6LED, *8$;

 

 

void LED'ff $%

 di/italWiteP1LED, L'W$;

 di/italWiteP2LED, L'W$;

 di/italWiteP3LED, L'W$;

 di/italWiteP4LED, L'W$;

 di/italWiteP5LED, L'W$;

 di/italWiteP6LED, L'W$;

  

" 6ee ore at$ http$//diy"scibor0/blo0/ui*"show"controller@sthash5h='a1b*dpu' 

Page 7: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 7/10

:: -)ineo..y-o<

:: +atalia a/a +o<an:: D!al even>e/<ent LED Di"lay

:: ?o<<on Anode di/it 1 "in 10

:: ?o<<on Anode di/it 2 "in 5

:: ?A1 8 A @

:: >B "in and e/<ent tey ontol

:: >>>>>>>>> >>>>>>>>>

:: A A

:: @ @

:: >>>8>>> >>>8>>>

:: E ? E ?

:: D D

:: >>>>>>>>> >>>>>>>>>:: >B "in and e/<ent tey ontol

:: D DP E ? ?A2

:: Se/<ent tat <ae ea n!<.e en lit

:: 0 =B >ED?@A

:: 1 =B >>>>@?>

:: 2 =B 8>ED>@A

:: 3 =B 8>>D?@A

:: 4 =B 8>>?@>

Page 8: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 8/10

:: 5 =B 8>D?>A

:: 6 =B 8ED?>A

:: 7 =B >>>>?@A

:: C =B 8ED?@A

:: =B 8>D?@A

:: Ad!ino di/ital "in !ed to li/t !"

:: oe"ondin/ e/<ent on te LED di"lay

#define A 3

#define @ 2

#define ? 6

#define D C

#define E 7

#define 4

#define 8 5

:: Pin divin/ o<<on anode

#define ?A1 13

#define ?A2 12

:: Pin fo A @ ? D E 8, in e!eneont int e/7F = % A, @, ?, D, E, , 8 ;

:: Se/<ent tat <ae ea n!<.e

ont .yte n!<.e10F = % 0.1000000, 0.1111001, 0.0100100, 0.0110000,

0.0011001, 0.0010010,

0.0000010, 0.1111000, 0.0000000, 0.0010000 ;

void et!"$ %

  "in&odeA, '()P()$;

  "in&ode@, '()P()$;

  "in&ode?, '()P()$;

  "in&odeD, '()P()$;

  "in&odeE, '()P()$;

  "in&ode, '()P()$;

  "in&ode8, '()P()$;

  "in&ode?A1, '()P()$;

  "in&ode?A2, '()P()$;

void loo"$ %

  fo int di/it1=0; di/it1 G 10; di/it1HH$ %

  fo int di/it2=0; di/it2 G 10; di/it2HH$ %

  !ni/ned lon/ tat)i<e = <illi$;

  fo !ni/ned lon/ ela"ed=0; ela"ed G 600; ela"ed = <illi$ >

tat)i<e$ %

  li/tDi/it1n!<.edi/it1F$;

  delay5$;  li/tDi/it2n!<.edi/it2F$;

  delay5$;

 

 

 

void li/tDi/it1.yte n!<.e$ %

  di/italWite?A1, L'W$;

Page 9: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 9/10

  di/italWite?A2, *8$;

  li/tSe/<entn!<.e$;

void li/tDi/it2.yte n!<.e$ %

  di/italWite?A1, *8$;

  di/italWite?A2, L'W$;

  li/tSe/<entn!<.e$;

void li/tSe/<ent.yte n!<.e$ %

  fo int i = 0; i G 7; iHH$ %

  int .it = .iteadn!<.e, i$;

  di/italWitee/iF, .it$;

 

Page 10: Quiz Show Controller

8/9/2019 Quiz Show Controller

http://slidepdf.com/reader/full/quiz-show-controller 10/10