BCD score keeper help
hi all,
i can't find first post topic, i'm still stuck. i'm programming shooting gallery , can't seem figure out how keep score. have 2 bcd chips connected 2 7-segment displays. displays reading 00 fine. can't score increment after each hit of target. can please shed light on me? relevant code included. thanks! not sure if entered code correctly.
i can't find first post topic, i'm still stuck. i'm programming shooting gallery , can't seem figure out how keep score. have 2 bcd chips connected 2 7-segment displays. displays reading 00 fine. can't score increment after each hit of target. can please shed light on me? relevant code included. thanks! not sure if entered code correctly.
code: [select]
[/ /*
*/
const int = 34; // bcd 1a (to bcd - 7 segment ic)
const int b = 35; // bcd 1b (to bcd - 7 segment ic)
const int c = 36; // bcd 1c (to bcd - 7 segment ic)
const int d = 37; // bcd 1d (to bcd - 7 segment ic)
const int aa = 38; // bcd 2a (to bcd - 7 segment ic)
const int bb = 39; // bcd 2b (to bcd - 7 segment ic)
const int cc = 40; // bcd 2c (to bcd - 7 segment ic)
const int dd = 41; // bcd 2d (to bcd - 7 segment ic)
int target2state = 0; // variable reading target1 status
int target3state = 0; // variable reading target2 status
int target4state = 0; // variable reading target3 status
int target5state = 0; // variable reading target4 status
int target6state = 0; // variable reading target5 status
int target7state = 0; // variable reading target6 status
int target8state = 0; // variable reading target7 status
int target9state = 0; // variable reading target8 status
int target10state = 0; // variable reading target9 status
int target11state = 0; // variable reading target10 status
int pos = 0; // variable store servo position
int brightness = 0; // how bright led is
int fadeamount = 5; // how many points fade led by
int counter = 0;
int num_array[10][9] = { { 0,0,0,0,0,0,0,0 }, // 0
{ 0,0,0,0,0,0,0,1 }, // 1
{ 0,0,0,0,0,0,1,0 }, // 2
{ 0,0,0,0,0,0,1,1 }, // 3
{ 0,0,0,0,0,1,0,0 }, // 4
{ 0,0,0,0,0,1,0,1 }, // 5
{ 0,0,0,0,0,1,1,0 }, // 6
{ 0,0,0,0,0,1,1,1 }, // 7
{ 0,0,0,0,1,0,0,0 }, // 8
{ 0,0,0,0,1,0,0,1 }}; // 9
void setup() {
serial.begin(4800); //set 4800 bps sound card
//serial.print(0xef); //reset mp3 player
delay(2000);
giraffestepper.setspeed(80);
cobraservo.attach(12); // attaches servo on pin 12 servo object
mickeyservo.attach(13); // attaches servo on pin 13 servo object
for(int = 2; <=11; i++){
pinmode(i, input); // initialize target pins 2-11 inputs:
}
for(int = 22; <=53; i++){
pinmode(i, output); // initialize attraction pins 22-53 outputs:
cobraservo.write(90);
mickeyservo.write(179);
}
pinmode(wheel3pin, output);
pinmode(eyepin, output);
pinmode(fantpin, output);
digitalwrite(a, low);
digitalwrite(b, low);
digitalwrite(c, low);
digitalwrite(d, low);
digitalwrite(aa, low);
digitalwrite(bb, low);
digitalwrite(cc, low);
digitalwrite(dd, low);
delay(10);
}
void loop(){
// read state of targets:
target11state = digitalread(target11pin); // start
if (target11state == high) { //read start button
serial.print(001);
digitalwrite(fantpin, high);
target3state = digitalread(target3pin); //
target4state = digitalread(target4pin); // twinks
target5state = digitalread(target5pin); // cobra
target6state = digitalread(target6pin); // animals
target7state = digitalread(target7pin); // cannon
target8state = digitalread(target8pin); // sr cannoe
target9state = digitalread(target9pin); // sl cannoe
target10state = digitalread(target10pin); // mickey mountain
if (target4state == high) { //read twinks
// turn led on:
for (int counter = 0; counter < 20; ++counter)
{
num_write(counter+1);
}
digitalwrite(game24pin, low);
}
else {
digitalwrite(game24pin, low);
}
}
void num_write(int);
counter == 1{
digitalwrite(a,high);
digitalwrite(b,low);
digitalwrite(c,low);
digitalwrite(d,low);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 2{
digitalwrite(a,low);
digitalwrite(b,high);
digitalwrite(c,low);
digitalwrite(d,low);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 3{
digitalwrite(a,high);
digitalwrite(b,high);
digitalwrite(c,low);
digitalwrite(d,low);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 4{
digitalwrite(a,low);
digitalwrite(b,low);
digitalwrite(c,high);
digitalwrite(d,low);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 5{
digitalwrite(a,high);
digitalwrite(b,low);
digitalwrite(c,high);
digitalwrite(d,low);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 6{
digitalwrite(a,low);
digitalwrite(b,high);
digitalwrite(c,high);
digitalwrite(d,low);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 7{
digitalwrite(a,high);
digitalwrite(b,high);
digitalwrite(c,high);
digitalwrite(d,low);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 8{
digitalwrite(a,low);
digitalwrite(b,low);
digitalwrite(c,low);
digitalwrite(d,high);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 9{
digitalwrite(a,high);
digitalwrite(b,low);
digitalwrite(c,low);
digitalwrite(d,high);
digitalwrite(aa,low);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 10{
digitalwrite(a,low);
digitalwrite(b,low);
digitalwrite(c,low);
digitalwrite(d,low);
digitalwrite(aa,high);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
counter == 11{
digitalwrite(a,high);
digitalwrite(b,low);
digitalwrite(c,low);
digitalwrite(d,low);
digitalwrite(aa,high);
digitalwrite(bb,low);
digitalwrite(cc,low);
digitalwrite(dd,low);
}
}
}
code]
quote
i can't find first post topicit's here
if click on username, you'll see profile details control labelled "show posts" - that's how can find previous posts
Arduino Forum > Using Arduino > Programming Questions > BCD score keeper help
arduino
Comments
Post a Comment