Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:proiecte:2025sric:racing-game-simulator [2025/05/28 19:44]
ionut_razvan.stan [Software]
iothings:proiecte:2025sric:racing-game-simulator [2025/05/28 20:47] (current)
ionut_razvan.stan [System Architecture]
Line 27: Line 27:
  
  * displays the game and adapts to the inputs given in a concurrently safe way  * displays the game and adapts to the inputs given in a concurrently safe way
 +
 +The ESP 32 Dev Module is plugged into a breadboard, with the ground pin connected to the power rail, as well as the 5V pin. There are two IR FC-51 Sensors on a smaller breadboard, with the ground pins connected to the ground rail, the VCC pins connected to the 5V rail, and the output of the "​left"​ sensor to the 34th GPIO pin, "​right"​ being pin 35. In addition, two buttons, connected on another breadboard for "​forward"​ and "​back"​. They get ground from the main ground rail, and their other connectors are plugged into pins 27 and 26.
 ====== Hardware ====== ====== Hardware ======
 The Hardware is composed of : The Hardware is composed of :
Line 47: Line 49:
  
 ''​ ''​
-void setup() { 
-  Serial.begin(115200);​ 
-  pinMode(forwardButtonPin,​ INPUT_PULLUP);​ // Enables internal pull-up 
-  pinMode(backwardButtonPin,​ INPUT_PULLUP);​ 
  
-  WiFi.begin(ssid,​ password); 
-  Serial.println("​Connecting"​);​ 
-  while (WiFi.status() != WL_CONNECTED) { 
-    delay(500); 
-    Serial.print("​."​);​ 
-  } 
-  Serial.println(""​);​ 
-  Serial.print("​Connected to WiFi network with IP Address: "); 
-  Serial.println(WiFi.localIP());​ 
-} 
 #define DISTANCE_THRESHHOLD 3000 #define DISTANCE_THRESHHOLD 3000
 void loop() { void loop() {
Line 122: Line 110:
     lastTime = millis();     lastTime = millis();
   }   }
-} +}''​
-''​+
  
  
  
 The game frontend uses the standard HTTP library from Golang to listen to HTTP requests at a certain point. It also uses Raylib (through a community made binding module) to render 3D Graphics. The game frontend uses the standard HTTP library from Golang to listen to HTTP requests at a certain point. It also uses Raylib (through a community made binding module) to render 3D Graphics.
- 
  
  
 ''​ ''​
- 
 func handler(w http.ResponseWriter,​ r *http.Request) { func handler(w http.ResponseWriter,​ r *http.Request) {
  // fmt.Printf("​Received a %s request at %s\n", r.Method, r.URL.Path) // Prints for any request  // fmt.Printf("​Received a %s request at %s\n", r.Method, r.URL.Path) // Prints for any request
Line 182: Line 167:
  screenWidth := int32(1600)  screenWidth := int32(1600)
  screenHeight := int32(900)  screenHeight := int32(900)
-//...other code +// other code
- for !rl.WindowShouldClose() { +
-//...other code +
-// Input handling (unchanged)... +
- dirMutex.Lock() +
- if isUpPressed { +
- carSpeed += float32(carSpeedup) * dt +
- } else if isDownPressed { +
- carSpeed -= float32(carSlowdown) * dt +
- } else { +
- carSpeed *= 0.98 +
-+
- if carSpeed > MAX_SPEED { +
- carSpeed = MAX_SPEED +
-+
- if carSpeed < -MAX_SPEED { +
- carSpeed = -MAX_SPEED +
-+
- if isLeftPressed { +
- carRotation -= ROTATION_SPEED * dt +
- } else if isRightPressed { +
- carRotation += ROTATION_SPEED * dt +
-+
- if carRotation >= 360 { +
- for carRotation >= 360 { +
- carRotation -= 360 +
-+
-+
- dirMutex.Unlock() +
 } }
 ''​ ''​
  
-====== Challenges ====== 
- 
- 
-====== References ====== 
iothings/proiecte/2025sric/racing-game-simulator.1748450678.txt.gz · Last modified: 2025/05/28 19:44 by ionut_razvan.stan
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0