Go Down

Topic: PAID JOB for PROGRAMMER (Read 2188 times) previous topic - next topic

PMKimpton

I urgently need some help from a programmer to finish off the code for an 8x8 matrix PONG game.
I have a deadline of TOMORROW to get this finished. Seeing as everyone here wants me "learn" (which I agree with) I simply don't have time, this project needs to be finished tonight. I'm confident that anyone who knows how to code an Arduino will get this resolved in a few minutes.
I'm prepared to pay cash for the help, please PM me if you can/want to help.

retrolefty


I urgently need some help from a programmer to finish off the code for an 8x8 matrix PONG game.
I have a deadline of TOMORROW to get this finished. Seeing as everyone here wants me "learn" (which I agree with) I simply don't have time, this project needs to be finished tonight. I'm confident that anyone who knows how to code an Arduino will get this resolved in a few minutes.
I'm prepared to pay cash for the help, please PM me if you can/want to help.



And what happens to you personally if the deadline is missed? Life or death? Bad grade? Lose your job? Lose the love of your children? I personally would need to know the nature of the deadline before I committed to such a contract.

Lefty

PMKimpton

#2
Dec 17, 2012, 07:26 pm Last Edit: Dec 17, 2012, 07:32 pm by PMKimpton Reason: 1
I'm due to see my mum!  :smiley-roll-sweat:

I promised to make her this display, its a present for her for Xmas to add to her Xmas display outside her house. After tomorrow I wont see her until Xmas day. Also I'm tied up with work commitments between now and Xmas and wont have any other time to finish it. Tonight is the last night I can't afford to waste more time on this project. I've spend the last 8 weeks, every spare second working on this and I'm exhausted with stress.
No-one's going to die, nor lose the love of their children, but all my work so far will have been a waste of time.

You'd be impressed with the hardware, I'm simply struggling with the code.

NB, The code is 99% complete. It works, its just the button push commands I cant resolve.

retrolefty

With that kind of time pressure your best bet is to try and find a way to post your existing code, post a schematic drawing of the complete project, and then try and explain what it's doing now that doesnt' match what you want it to do. There are very helpful people here and can many times can spot basic problems and solutions in mere minutes. But most likely you should have been seeking help here much sooner then just a few hours before your personal deadline approached. Live and learn I guess.

Lefty

PMKimpton

#4
Dec 17, 2012, 07:45 pm Last Edit: Dec 17, 2012, 07:47 pm by PMKimpton Reason: 1

There are very helpful people here


I have been asking for help for the past 3 days, I don't know where all those helpful people are but the certainly NOT in this Arduino forum. I have posted up code and questions and all I get back is comments like "Seems like we have another person wanting the code done for them and don't want to learn"

I DO want to learn, and I am, very fast indeed, but time has caught up with me on this one. The code is 99% completed!

To be quite honest, I had really been enjoying working with Arduino, but the very lack of help and advice from this forum has caused me no end of stress, waste of time and delay. Once this is working, the whole lot is going on eBay and I'll find a different hobby.

There doesn't even seem to be anyone wanting to get PAID to look at the code....  really helpful people on here....

AWOL

Quote
I have been asking for help for the past 3 days, I don't know where all those helpful people are but the certainly NOT in this Arduino forum.
They're all around you.
However, you'll have found how difficult it is to debug something when it is sitting on a bench in front of you.
Now imagine the hassle factor if you've got to rely on untrained eyes to do the debugging for you,
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

PMKimpton

Yes, I understand your point mate.

However, this isn't rocket science, my button works once, it just doesn't switch back. How hard can this be for someone who knows code? I've managed to get this far, I've already swam the channel, I just need some help onto the beach.

I'm sure I've just got a command in the wrong order.

I appreciate your your advice but it's still all going on eBay and I'm never coming back to Arduino projects  =(

I think my son and I will take up fishing instead...

retrolefty


Yes, I understand your point mate.

However, this isn't rocket science, my button works once, it just doesn't switch back. How hard can this be for someone who knows code? I've managed to get this far, I've already swam the channel, I just need some help onto the beach.

Well that could be as simple as how you wired your switch up incorrectly (and a very common problem for beginners to electronics) and you may be suffering from the dreaded 'floating input pin' condition. Tell us exactly how you have your switch wired up?

I'm sure I've just got a command in the wrong order.

I appreciate your your advice but it's still all going on eBay and I'm never coming back to Arduino projects  =(

I hope your Arduino finds a happy home.
Lefty


I think my son and I will take up fishing instead...

PMKimpton

Thanks Lefty,

I'm confident my button is correct. It's connected to pin 6 and being pulled down via a 10k resistor. When pressed a 5v high signal is passed to pin 6. I have even tested it using the serial monitor.

I believe my issue to be in the loop of my code. I have a command which states if LOW run PONG, else run PATTERN. I think I need to extend it to say; RUN PONG if LOW, RUN PATTERN if HIGH but all my experiments have failed.

Currently, the code runs and displays PONG. When I press the button it switches to PATTERN. Pressing the button again doesnt do anything.

retrolefty


Thanks Lefty,

I'm confident my button is correct. It's connected to pin 6 and being pulled down via a 10k resistor. When pressed a 5v high signal is passed to pin 6. I have even tested it using the serial monitor.

I believe my issue to be in the loop of my code. I have a command which states if LOW run PONG, else run PATTERN. I think I need to extend it to say; RUN PONG if LOW, RUN PATTERN if HIGH but all my experiments have failed.

Currently, the code runs and displays PONG. When I press the button it switches to PATTERN. Pressing the button again doesnt do anything.


Well then it could very well be your sketch structure is in error. However our problem is we can't yet see your code in this thread and even no link to older posting that may hold your code?

Lefty

PMKimpton

Sorry, I had posted up so much code I thought I was starting to annoy everyone :-)

The code is a mish-mash of other peoples code, I haven't written it, I've just added to and altered.

Currently, everything works fine, the pong game starts, press the button and the pattern displays, but that's where to goodness ends.

I need to be able to press the button a 2nd time to go back to pong, press again, back to pattern.

On the few times I've managed to get it to switch back and forth, the pong game messes up and the pattern loops just once and returns to pong by itself.

I've almost given up to be honest. I will just tell my mum to switch off the power to reset back to pong and then to press the button to see the pattern but it would be preferred if the button would switch back and forth between the two displays.

Code: [Select]

int cols[9] = {1,2,4,8,16,32,64,128, 0};
int rows[9] = {1,2,4,8,16,32,64,128, 255};

const int latchPin = 10;
const int clockPin = 9;
const int dataPin = 11;

int buzz = 3;
int bleep = 5;
int switchPin = 6;

int currState;
int prevState = HIGH;

int player_one = A1; //red-left
int player_two = A0; //blue-right
int p1_pos, p2_pos;

int ball_x=3, ball_y=3;
int ball_dir_x=1, ball_dir_y=-1;
int count = 0;

boolean playing = false;

void setup()
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);   
  pinMode(clockPin, OUTPUT);
  pinMode(bleep, OUTPUT);
  pinMode(switchPin, INPUT);
  //digitalWrite(switchPin, HIGH); // after the pinMode statement
  pinMode(buzz, OUTPUT);
  randomSeed(analogRead(5));
  //Serial.begin(115200);
}

void registerWrite(int rows,  int cols)
{
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, rows);
  shiftOut(dataPin, clockPin, MSBFIRST, cols);
  digitalWrite(latchPin, 1);
}

void resetAnim()
{
  digitalWrite(buzz, HIGH);
  delay(150);
  digitalWrite(buzz, LOW);
  delay(20);
  digitalWrite(buzz, HIGH);
  delay(150);
  digitalWrite(buzz, LOW);
  delay(20);
  digitalWrite(buzz, HIGH);
  delay(150);
  digitalWrite(buzz, LOW);
}

void resetBall()
{
  resetAnim();

  ball_x=3;
  ball_y = 4;
  ball_dir_x = 1;
  ball_dir_y = -1;
}

void getPlayerPositions()
{
  p1_pos = analogRead(player_one);
  p1_pos = p1_pos/128;
  p2_pos = analogRead(player_two);
  p2_pos = p2_pos/128; 
}

void renderBall()
{
  registerWrite(rows[ball_y], cols[ball_x]);
  delay(3);
  registerWrite(rows[8], cols[8]);
  delay(3); 


void moveBall()
{
  digitalWrite(bleep, HIGH);
  delay(2);
  digitalWrite(bleep, LOW);
  ball_x += ball_dir_x;
  ball_y += ball_dir_y;

}

void checkLocationAndBounce()
{
  // bounce on y
  if(ball_y >= 7)
    ball_dir_y= -1;
  else if(ball_y <= 0)
    ball_dir_y = 1;

  // on x only bounce if player
  // paddle is on same spot
  if(ball_x == 7 && ball_y == p1_pos)
  {
    randomBounceBack();
    ball_dir_x= -1;
  }
  else if(ball_x == 7)
  {
    resetBall();
  }
  else if(ball_x == 0 && ball_y == p2_pos) {
    randomBounceBack();
    ball_dir_x = 1;   
  } 
  else if(ball_x == 0)
  {
    resetBall();
  }
}

void randomBounceBack()
{
  // set a random Y direction when we
  // bounce on a paddle
  int y_dir = random(3);
  switch(y_dir)
  {
  case 0:
    ball_dir_y = -1;
    break;
  case 1:
    ball_dir_y = 0;
    break;
  case 2:
    ball_dir_y = 1;
    break;
  } 
}

void renderPlayerPaddles()
{
  getPlayerPositions();
  registerWrite(rows[p2_pos], cols[0]);
  delay(3);
  registerWrite(rows[8], cols[8]);
  delay(3);
  registerWrite(rows[p1_pos], cols[7]); 
  delay(3);
  registerWrite(rows[8], cols[8]);
  delay(3);
}

void pong()

  renderBall();
  renderPlayerPaddles();
  if(count >10)
  { 
    moveBall();
    checkLocationAndBounce();
    count = 0;
  }
  count++;
}

void pattern()
{
  for (int character = 0; character < 8; character ++)
  {
    switch (character)
    {
    case 0:
      rows[7] = 0b10100011;
      rows[6] = 0b10001001;
      rows[5] = 0b10010001;
      rows[4] = 0b11000101;
      rows[3] = 0b10001011;
      rows[2] = 0b10100001;
      rows[1] = 0b11001001;
      rows[0] = 0b10000001;
      break;

    case 1:
      rows[0] = 0b10100011;
      rows[7] = 0b10001001;
      rows[6] = 0b10010001;
      rows[5] = 0b11000101;
      rows[4] = 0b10001011;
      rows[3] = 0b10100001;
      rows[2] = 0b11001001;
      rows[1] = 0b10000001;
      break;

    case 2:
      rows[1] = 0b10100011;
      rows[0] = 0b10001001;
      rows[7] = 0b10010001;
      rows[6] = 0b11000101;
      rows[5] = 0b10001011;
      rows[4] = 0b10100001;
      rows[3] = 0b11001001;
      rows[2] = 0b10000001;
      break;

    case 3:
      rows[2] = 0b10100011;
      rows[1] = 0b10001001;
      rows[0] = 0b10010001;
      rows[7] = 0b11000101;
      rows[6] = 0b10001011;
      rows[5] = 0b10100001;
      rows[4] = 0b11001001;
      rows[3] = 0b10000001;
      break;

    case 4:
      rows[3] = 0b10100011;
      rows[2] = 0b10001001;
      rows[1] = 0b10010001;
      rows[0] = 0b11000101;
      rows[7] = 0b10001011;
      rows[6] = 0b10100001;
      rows[5] = 0b11001001;
      rows[4] = 0b10000001;
      break;

    case 5:
      rows[4] = 0b10100011;
      rows[3] = 0b10001001;
      rows[2] = 0b10010001;
      rows[1] = 0b11000101;
      rows[0] = 0b10001011;
      rows[7] = 0b10100001;
      rows[6] = 0b11001001;
      rows[5] = 0b10000001;
      break;

    case 6:
      rows[5] = 0b10100011;
      rows[4] = 0b10001001;
      rows[3] = 0b10010001;
      rows[2] = 0b11000101;
      rows[1] = 0b10001011;
      rows[0] = 0b10100001;
      rows[7] = 0b11001001;
      rows[6] = 0b10000001;
      break;

    case 7:
      rows[6] = 0b10100011;
      rows[5] = 0b10001001;
      rows[4] = 0b10010001;
      rows[3] = 0b11000101;
      rows[2] = 0b10001011;
      rows[1] = 0b10100001;
      rows[0] = 0b11001001;
      rows[7] = 0b10000001;
      break;
    }

    for (int refreshed = 0; refreshed < 200; refreshed++)
    {
      for (int count = 0; count < 8; count ++)
      {
        digitalWrite(latchPin, LOW);
        shiftOut(dataPin, clockPin, MSBFIRST, cols[count]);
        shiftOut(dataPin, clockPin, LSBFIRST, rows[count]);
        digitalWrite(latchPin, HIGH);
      }
    }
  }
}


void loop()
{
//Serial.print(currState != prevState);
//Serial.println();

  currState = digitalRead(switchPin);
  if(currState != prevState)
  {
    if(currState == HIGH)
    {
      playing = true;
    }
  }
  prevState = currState;

  if(playing)
    pattern();
    else
    pong();
}


Graynomad

It may already be too late (I'm in Aus) but am I correct is saying that all you need to do is toggle between two states?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Graynomad

I see it's about 1AM in the UK and you've just gone offline.

In case you have the time and the inclination in the morning and I'm not paying attention here's a version of your code that should do what I perceive you want to do.

Code: [Select]
int cols[9] = {
  1,2,4,8,16,32,64,128, 0};
int rows[9] = {
  1,2,4,8,16,32,64,128, 255};

const int latchPin = 10;
const int clockPin = 9;
const int dataPin = 11;

int buzz = 3;
int bleep = 5;
int switchPin = 6;

#define MODE_PONG 1
#define MODE_PATTERN 2

int currState;
int prevState = HIGH;
int displayMode = MODE_PATTERN;

int player_one = A1; //red-left
int player_two = A0; //blue-right
int p1_pos, p2_pos;

int ball_x=3, ball_y=3;
int ball_dir_x=1, ball_dir_y=-1;
int count = 0;

boolean playing = false;

void setup()
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);   
  pinMode(clockPin, OUTPUT);
  pinMode(bleep, OUTPUT);
  pinMode(switchPin, INPUT);
  //digitalWrite(switchPin, HIGH); // after the pinMode statement
  pinMode(buzz, OUTPUT);
  randomSeed(analogRead(5));
  //Serial.begin(115200);
}

void registerWrite(int rows,  int cols)
{
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, rows);
  shiftOut(dataPin, clockPin, MSBFIRST, cols);
  digitalWrite(latchPin, 1);
}

void resetAnim()
{
  digitalWrite(buzz, HIGH);
  delay(150);
  digitalWrite(buzz, LOW);
  delay(20);
  digitalWrite(buzz, HIGH);
  delay(150);
  digitalWrite(buzz, LOW);
  delay(20);
  digitalWrite(buzz, HIGH);
  delay(150);
  digitalWrite(buzz, LOW);
}

void resetBall()
{
  resetAnim();

  ball_x=3;
  ball_y = 4;
  ball_dir_x = 1;
  ball_dir_y = -1;
}

void getPlayerPositions()
{
  p1_pos = analogRead(player_one);
  p1_pos = p1_pos/128;
  p2_pos = analogRead(player_two);
  p2_pos = p2_pos/128; 
}

void renderBall()
{
  registerWrite(rows[ball_y], cols[ball_x]);
  delay(3);
  registerWrite(rows[8], cols[8]);
  delay(3); 


void moveBall()
{
  digitalWrite(bleep, HIGH);
  delay(2);
  digitalWrite(bleep, LOW);
  ball_x += ball_dir_x;
  ball_y += ball_dir_y;

}

void checkLocationAndBounce()
{
  // bounce on y
  if(ball_y >= 7)
    ball_dir_y= -1;
  else if(ball_y <= 0)
    ball_dir_y = 1;

  // on x only bounce if player
  // paddle is on same spot
  if(ball_x == 7 && ball_y == p1_pos)
  {
    randomBounceBack();
    ball_dir_x= -1;
  }
  else if(ball_x == 7)
  {
    resetBall();
  }
  else if(ball_x == 0 && ball_y == p2_pos) {
    randomBounceBack();
    ball_dir_x = 1;   
  } 
  else if(ball_x == 0)
  {
    resetBall();
  }
}

void randomBounceBack()
{
  // set a random Y direction when we
  // bounce on a paddle
  int y_dir = random(3);
  switch(y_dir)
  {
  case 0:
    ball_dir_y = -1;
    break;
  case 1:
    ball_dir_y = 0;
    break;
  case 2:
    ball_dir_y = 1;
    break;
  } 
}

void renderPlayerPaddles()
{
  getPlayerPositions();
  registerWrite(rows[p2_pos], cols[0]);
  delay(3);
  registerWrite(rows[8], cols[8]);
  delay(3);
  registerWrite(rows[p1_pos], cols[7]); 
  delay(3);
  registerWrite(rows[8], cols[8]);
  delay(3);
}

void pong()

  renderBall();
  renderPlayerPaddles();
  if(count >10)
  { 
    moveBall();
    checkLocationAndBounce();
    count = 0;
  }
  count++;
}

void pattern()
{
  for (int character = 0; character < 8; character ++)
  {
    if (checkButtonPress()) return;
    switch (character)
    {
    case 0:
      rows[7] = 0b10100011;
      rows[6] = 0b10001001;
      rows[5] = 0b10010001;
      rows[4] = 0b11000101;
      rows[3] = 0b10001011;
      rows[2] = 0b10100001;
      rows[1] = 0b11001001;
      rows[0] = 0b10000001;
      break;

    case 1:
      rows[0] = 0b10100011;
      rows[7] = 0b10001001;
      rows[6] = 0b10010001;
      rows[5] = 0b11000101;
      rows[4] = 0b10001011;
      rows[3] = 0b10100001;
      rows[2] = 0b11001001;
      rows[1] = 0b10000001;
      break;

    case 2:
      rows[1] = 0b10100011;
      rows[0] = 0b10001001;
      rows[7] = 0b10010001;
      rows[6] = 0b11000101;
      rows[5] = 0b10001011;
      rows[4] = 0b10100001;
      rows[3] = 0b11001001;
      rows[2] = 0b10000001;
      break;

    case 3:
      rows[2] = 0b10100011;
      rows[1] = 0b10001001;
      rows[0] = 0b10010001;
      rows[7] = 0b11000101;
      rows[6] = 0b10001011;
      rows[5] = 0b10100001;
      rows[4] = 0b11001001;
      rows[3] = 0b10000001;
      break;

    case 4:
      rows[3] = 0b10100011;
      rows[2] = 0b10001001;
      rows[1] = 0b10010001;
      rows[0] = 0b11000101;
      rows[7] = 0b10001011;
      rows[6] = 0b10100001;
      rows[5] = 0b11001001;
      rows[4] = 0b10000001;
      break;

    case 5:
      rows[4] = 0b10100011;
      rows[3] = 0b10001001;
      rows[2] = 0b10010001;
      rows[1] = 0b11000101;
      rows[0] = 0b10001011;
      rows[7] = 0b10100001;
      rows[6] = 0b11001001;
      rows[5] = 0b10000001;
      break;

    case 6:
      rows[5] = 0b10100011;
      rows[4] = 0b10001001;
      rows[3] = 0b10010001;
      rows[2] = 0b11000101;
      rows[1] = 0b10001011;
      rows[0] = 0b10100001;
      rows[7] = 0b11001001;
      rows[6] = 0b10000001;
      break;

    case 7:
      rows[6] = 0b10100011;
      rows[5] = 0b10001001;
      rows[4] = 0b10010001;
      rows[3] = 0b11000101;
      rows[2] = 0b10001011;
      rows[1] = 0b10100001;
      rows[0] = 0b11001001;
      rows[7] = 0b10000001;
      break;
    }

    for (int refreshed = 0; refreshed < 200; refreshed++) {
      if (checkButtonPress()) return;
      for (int count = 0; count < 8; count ++) {
        if (checkButtonPress()) return;
        digitalWrite(latchPin, LOW);
        shiftOut(dataPin, clockPin, MSBFIRST, cols[count]);
        shiftOut(dataPin, clockPin, LSBFIRST, rows[count]);
        digitalWrite(latchPin, HIGH);
      }
    }
  }
}

int checkButtonPress () {
  currState = digitalRead(switchPin);
  if(currState != prevState) {
    delay (30);
    if(currState != prevState)  { // quick and dirty debounce
      displayMode == MODE_PATTERN ? MODE_PONG : MODE_PATTERN;
      prevState = currState;
      return true;
    }
  }
  return false;
}

void loop()
{
  if(displayMode == MODE_PATTERN)
    pattern();
  else
    pong();

}



_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Arrch


I have been asking for help for the past 3 days, I don't know where all those helpful people are but the certainly NOT in this Arduino forum. I have posted up code and questions and all I get back is comments like "Seems like we have another person wanting the code done for them and don't want to learn"



Which I later corrected from "don't want to learn" to don't have "time to learn". I also did attempted to help you, but your definition of help differs from what typically constitutes help.

Quote
I DO want to learn, and I am, very fast indeed, but time has caught up with me on this one. The code is 99% completed!


So my revised assessment is correct.

Quote
To be quite honest, I had really been enjoying working with Arduino, but the very lack of help and advice from this forum has caused me no end of stress, waste of time and delay. Once this is working, the whole lot is going on eBay and I'll find a different hobby.

Don't let the door hit you on the way out...

Go Up