I bought the head from an old mechanical williams pitch and bat and I would like to turn it into a scoreboard for mlb games.
I am extremely new to any type of coding and arduino.
The issue i dont know how to solve is getting the scores.
I have a relay bank that will activate different solenoids and I can figure out the logic to those but my end goal is to pick a specific team and then display the following stats
Home Score
Away Score
inning
current outs
current balls
current strikes
so every time a new batter comes up i will reset the the balls, strikes,and outs
i dont know how to get that data into my arduino. i am currently using a nano but plan on upgrading to a Giga R1 with wifi. I was thinking of eventually having a scrolling LED display on top that says the current batter or something but that is later down the line.
I dont care if i have to pay for a subscription as long as its not outrageous.
const int numRelays = 16; // Number of relays
const int relayPins[numRelays] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, A0, A1, A2, A3}; // Define relay pins
void setup() {
// Set all relay pins as OUTPUT
for (int i = 0; i < numRelays; i++) {
pinMode(relayPins[i], OUTPUT);
digitalWrite(relayPins[i], LOW); // Ensure all relays are initially off
}
Serial.begin(9600); // Initialize serial communication
Serial.println("Enter the number of times to close each relay:");
}
void loop() {
// Relay 1
Serial.println("Enter the number of times to close relay 1:");
while (Serial.available() == 0) {}
int numClosures1 = Serial.parseInt();
closeRelay(0, numClosures1); // Close relay 1
/* // Relay 2
Serial.println("Enter the number of times to close relay 2:");
while (Serial.available() == 0) {}
int numClosures2 = Serial.parseInt();
closeRelay(1, numClosures2); // Close relay 2
// Relay 3
Serial.println("Enter the number of times to close relay 3:");
while (Serial.available() == 0) {}
int numClosures3 = Serial.parseInt();
closeRelay(2, numClosures3); // Close relay 3
*/
// Add similar blocks for remaining relays...
}
// Function to close a relay
void closeRelay(int relayIndex, int numClosures) {
if (numClosures > 0) {
for (int j = 0; j < numClosures; j++) {
digitalWrite(relayPins[relayIndex], HIGH);
delay(500); // Adjust delay as needed (milliseconds)
digitalWrite(relayPins[relayIndex], LOW);
delay(500); // Adjust delay as needed (milliseconds)
}
Serial.print("Relay ");
Serial.print(relayIndex + 1);
Serial.println(" closed.");
} else {
Serial.print("Invalid input for relay ");
Serial.print(relayIndex + 1);
Serial.println(". Please enter a positive number.");
}
}