This classic game may make some of us feel childhood nostalgia. The game-play is simple, try to avoid hitting opponent cars and get many score as possible. The car can switch between 5 lanes, and there are 15 different speeds. As speed increases, opponent cars will run faster, making the game more difficult.
1.Stack PHPoC shield on Arduino. 2. Connect pin GND, VCC, and SIG of rotary angle sensor to GND, 5V and A0 of Arduino, respectively.
Arduino ---> PHPoC Shield ---> Web browser
User interacts with rotary angle sensor. The input signal value of rotary angle sensor is used to switch the car's position.
Arduino reads the value from rotary angle sensor. The input ADC values are divided into 5 different levels. Switching between levels means changing the lane. Simply, if the input signal is switched to another level, Arduino will send the updated level to PHPoC Shield.
When receiving the value, PHPoC WiFi Shield send it to Web Browser via Websocket. Then, JavaScript function will update the position (lane) of the car. JavaScript program will continuously update position of opponents and game speed as well.
- Set up WiFi connection for PHPoC shield (SSID and password)
- Upload new UI to PHPoC shield
- Upload Arduino code
See this instruction [http://www.phpoc.com/support/manual/p4s-347_user_manual/contents.php?id=network_first_setup].
- Download PHPoC source code remote_racing_game.php.
- Upload it to PHPoC shield using PHPoC debugger according to this instruction[http://www.phpoc.com/support/manual/phpoc_debugger_manual/contents.php?id=major_upload].
- Install PHPoC Library for Arduino (https://www.arduino.cc/en/Guide/Libraries).
- Upload Arduino code to Arduino
- Click serial button on Arduino IDE to get the IP address.
- Open web browser, type http:// relace_ip_address_here/remote_racing_game.php
- Click connect button and enjoy the game.