Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: **Scoreboard Display**
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-12-02 11:36:29
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* i need a code that gathers information on a */
- /* football match */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Wire.h>
- #include <SPI.h>
- #include <Servo.h>
- #include <LiquidCrystal.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void gatherMatchInfo(void);
- /****** GLOBAL VARIABLES *****/
- String teamA = "Team A";
- String teamB = "Team B";
- int scoreA = 0;
- int scoreB = 0;
- unsigned long matchTime = 0; // in seconds
- // LCD setup (assuming a 16x2 LCD)
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // RS, E, D4, D5, D6, D7
- void setup(void)
- {
- // Initialize the LCD
- lcd.begin(16, 2);
- lcd.print("Match Info");
- delay(2000);
- lcd.clear();
- // Initialize Serial for debugging
- Serial.begin(9600);
- }
- void loop(void)
- {
- // Gather match information
- gatherMatchInfo();
- // Display the match information on the LCD
- lcd.setCursor(0, 0);
- lcd.print(teamA + ": " + String(scoreA));
- lcd.setCursor(0, 1);
- lcd.print(teamB + ": " + String(scoreB));
- // Simulate match time
- matchTime++;
- delay(1000); // Update every second
- }
- // Function to gather match information
- void gatherMatchInfo(void)
- {
- // Simulate score updates (for demonstration purposes)
- if (matchTime % 10 == 0) { // Every 10 seconds
- scoreA += random(0, 2); // Randomly score 0 or 1 for Team A
- scoreB += random(0, 2); // Randomly score 0 or 1 for Team B
- Serial.print("Score Update: ");
- Serial.print(teamA);
- Serial.print(" ");
- Serial.print(scoreA);
- Serial.print(" - ");
- Serial.print(teamB);
- Serial.println(scoreB);
- }
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement