I'm creating an interactive basketball game,
but I need help with the Arduino coding.
Equipment I have:
2 -Arduino's
3 -7-Segment 6.5" Displays (found at Sparkfun)
2 - Sharps (SEN-00242 Infrared Proximity Sensor - Sharp GP2Y0A21YK AND SEN-08958 Infrared Proximity Sensor Long Range - Sharp GP2Y0A02YK0F)
What I need it to do:
1. Sense how far away a person is (sharp #1)
2. Do they make it into the basket? (sharp #2)
3. Add appropriate points (based on distance) to score board (0-3 ft = 2pt; 3-6ft = 5 pts; 6+ ft = 10 pts)
that's basically it.
4. after a certain amount of time, have the whole thing reset for a new user.
You are more likely to get help if you ask a detailed specific question (and provide the code you have written so far, along with what problems you have with it).
int segmentA = 0;
int segmentB = 1;
int segmentC = 2;
int segmentD = 3;
int segmentE = 4;
int segmentF = 5;
int segmentG = 6;
int segmentP = 7;
/*int digit1 = 10;
int digit2 = 11;
int digit3 = 12;
int digit4 = 13;*/
/*
10 digits:
Each defines which segments should be on/off for that digit: A,B,C,D,E,F,G,P
*/
byte numbers[10] =
{
B11000000, // 0
B11111001, // 1
B10100100, // 2
B10110000, // 3
B10011001, // 4
B10010010, // 5
B10000010, // 6
B11111000, // 7
B10000000, // 8
B10010000 // 9
};
void setup() {
pinMode(segmentA,OUTPUT);
pinMode(segmentB,OUTPUT);
pinMode(segmentC,OUTPUT);
pinMode(segmentD,OUTPUT);
pinMode(segmentE,OUTPUT);
pinMode(segmentF,OUTPUT);
pinMode(segmentG,OUTPUT);
pinMode(segmentP,OUTPUT);
/* pinMode(digit1,OUTPUT);
pinMode(digit2,OUTPUT);
pinMode(digit3,OUTPUT);
pinMode(digit4,OUTPUT);*/
// declare the ledPin as an OUTPUT:
Serial.begin(9600);
}
int sharp1pin = 1; // select the input pin for sharp1
int sharp2pin = 2; // select the input pin for sharp2
int ledPin = 3; // pin that the LED is attached to
int ledPin2 = 4; // pin that the LED is attached to
int digitPosition = 0;
void loop() {
// read the value from the sensor:
// sharp1Value = analogRead(sharp1pin);
//sharp2Value = analogRead(sharp2pin);
//Serial.println(sharp1Value);
//Serial.println(sharp2Value);
if (sharp1pin < 200) { //IF SHARP1 SENSES LESS THAN 8FT
digitalWrite(digitPosition +2)
}
if (sharp2pin > 200) { //IF SHARP SENSES MORE THAN 8FT
digitalWrite(digitPosition +3)
}
/* else {
//do nothing
}*/
delay(100);
}
Ok, so here's what I'm working with now, it's not working YET... suggestions??