Enter Your Electronics & Design Project for a chance to win a $200 shopping cart! Back to homepage | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
Browsing projects based on the Raspberry Pi Pico I have found one which uses the TinyUSB and IwIP projects to create simple web client or server available via emulated USB ethernet. This example is documented and available here: https://github.com/maxnet/pico-webserver. I have decided to modify little this example to host basic HTML games on the Raspberry Pi Pico. I have found nice examples of basic HTML games here: https://gist.github.com/straker/. I have create simple index.html page with links to few HTML games. Below there is source code of this page:
<!DOCTYPE html> <html> <head> <style> body { margin: 0; font-family: Arial, Helvetica, sans-serif; } .bg-image { background-image: url("backgorund.jpg"); height: 1024px; background-position: center; background-repeat: no-repeat; background-size: cover; position: relative; } .bg-text { text-align: center; ; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; } </style> </head> <body> <div> <div> <h1 style="font-size:50px">Basic HTML games</h1> <form> <button type="submit" formaction="breakout.html">Breakout</button> <button type="submit" formaction="frogger.html">Frogger</button> <button type="submit" formaction="pong.html">Pong</button> <button type="submit" formaction="snake.html">Snake</button> <button type="submit" formaction="sokoban.html">Sokoban</button> <button type="submit" formaction="tetris.html">Tetris</button> </form> </div> </div> </body> </html>
After that is required to regenerate file system data by calling script called: regen-fsdata.sh. I have modified also file webserver.c and removed unused CGI handles. For this example we need only initialization of tinyusb, lwip, dhcpd and httpd. At the end I have generated image in format uf2 and copied it to Raspberry Pi Pico. After reboot in system is present a ethernet interface. When we type in browser following address: http://192.168.7.1/ we can see a main page hosted on Pico. Below there is short video presentation:
Top Comments