Category: raspberry-pi

Restarting the Raspberry PI C Games tutorials

Restarting the Raspberry PI C Games tutorials

Raspberry Pi 4I believe that the Raspberry PI, especially the 4B is a great and very low cost machine for not only running games but for developing them as well. Of course, if you have a PC, Linux or Mac then you can use that as a development machine but if you haven’t, it costs less than £100 (when you count the system, case, cables, SD-Card) to get up and running.

So I’m reworking my original eBook for the Raspberry Pi, using software running on the Pi and developing a 2nd ebook. Along the way I’ll publish longer excerpts from it here. Probably one a week.

 

 

Visual Studio Code Now supports ARM

Visual Studio Code Now supports ARM

Visual Studio Code 1.50Which means it supports Raspberry Pi. Of course I’ve been using it thanks to the code.headmelted.com version but it’s convenient now that both 32-bit and 64-bit ARM are available to download from the official site. As always, make sure you pick the .deb version either ARM for the 32-bit Raspberry Pi OS or ARM 64 if you have the 64-bit.

Apparently there is also a new C/C++ extension from Microsoft that I shall have to check out as well.

Also this means you can do remote code development. The idea is that you run Visual Studio Code on your PC/Mac whatever and connect to a program running on your PI (over WifI or a Network cable) using SSH. See the VS Code documentation for remote development.

A spot of market research

A spot of market research

Raspberry-Pi
Image by Benjamin Nelan from Pixabay

This is market research for a side-project I’m working on. I’m developing a server and mobile clients to play multi-player games over WiFi. The server software would cost about $15/£12 and 1$ for the game client on Android/iOS. It will come with 8-10 games including card games such as Texas Holdem, and a board game or two. All games will be single-player as well (well not poker!). If it takes off I’d like to licence popular board games.

There will also be an SDK for creating new games and some financial arrangements for games to be sold through a “Pi bakery” i.e. app store. Games can either be included in the standard package or low cost add-ons.

I’m just trying to assess if there would be demand for it. If you have any comments or thoughts, I’ve posted this on the Raspberry Pi forums. as well.

It is often said that you shouldn’t give away ideas but I’ve decided to anyway. I really need to find out if anybody would buy this. If not then I have a plan B side-project waiting in the wings. But I do like this and I’ve already gone down the implementation route a bit.

Update

Sadly I have decided to ditch this side-project. I didn’t get great response; although there are 31 million Pis out there, getting people together especially with Covid is not easy. So I’m mothballing this for now. There is a B2B commercial possibility but I’ll come back to that in a year or two. Instead I am going onto my next project a mobile MMO.

Willing to take a Risc?

Willing to take a Risc?

One of the understated and wrong assumptions about the Raspberry Pi is that you can try any flavour of Linux on it but Linux is really the only OS.  It is true that most of the 20+ OSRISC Os that you can try are based on Linux but there are a few that aren’t.

  • Windows IOT Core – a limited version of Windows
  • Risc OS – Created by the inventor of ARM
  • RaspBSD – More Unix than Linux.
  • Chromium OS. Turn your Pi into a Chromebook.

Of these, I think Risc OS looks the most interesting. It certainly isn’t Linux and it reminds me of the Archimedes, the first ARM computer.

Risc OS is 33 years old, it started in Cambridge in 1987 and is a descendant of the BBC Micro OS. And yes they do have a BBC BASIC available.  There’s  lot more background to it on this page  but bear in mind that it and the comments date back to 2012. It has an  ARM C compiler called Norcroft.

I won’t be oing any more with Risc OS, but thought it worth a mention. All of the stuff I’m doing will be on Linux OS.

Not. ARM is in the news because Apple have just announced that they will be transitioning from Intel CPUs to ARM over the next year or two.

 

Raspberry Pi – a couple more tips

Raspberry Pi – a couple more tips

Cogs
Image by Arek Socha from Pixabay

I have my Pi networked via a switch to my main (Windows) PC. I use WinSCP or my PC for copying files both ways but it means I’m not using the Pi for periods of 15 or 20 minutes.

Unfortunately the default display timeout on the Pi is 10 minutes. It’s not a bad thing but I decided I wanted an hour.

This fix seems to work. It came from this page on the Raspberry Pi forums.  To save you the effort of reading through a few different suggestions, the one that worked for me is this in a terminal (From the answer at 1.02 am). The 3600 is the time period in seconds in case you hadn’t guessed!

Apparently there are two timeout mechanism hence two commands are needed.

xset s 3600
xset dpms 3600 3600 3600

You can view the settings with

xset q

However to make these settings permanent, you need to edit the file:

sudo nano /etc/xdg/lxsession/LXDE/autostart

That way they are set at boot time.

Note. I’m not really a fan of nano. From Ubuntu I’ve used gedit quite a bit and it is a visual full-screen editor, not line by line like nano. Yeah you could use VS Code if it were open but then on files where you have to use sudo, it’s easier to use gedit.

So

sudo apt install gedit

will install it. Just gedit or sudo gedit (for those awkward files!)

 

 

 

Bit of an oddity with VS Code

Bit of an oddity with VS Code

When I first started using it, the C++ extension, and configuring for C++, I got a tasks.json one which was suited for gcc, but recently when I install it, (and the C/C++ Extension for Visual Studio Code, the only choices seem to be these. What happened to the the ones for clang/gcc? The one on the right is what I’m expecting. Even with a C/C++ file open as the instructions here say, I’m getting the one on the left.

VS Code ConfigureVs Configure C++
It’s possible that I’m getting this because I’m using the headmelted and VsCodium versions on a Raspberry Pi.

There’s a bit of a question mark about using the official extension on non-official build of Visual Studio. Headmelted allows it, but VsCodium has its own marketplace.

It’s easy enough to copy tasks.json over so not really a problem but just a minor irritation.

A pleasant surprise – scrot handles multiple screens

A pleasant surprise – scrot handles multiple screens

Scrot screenshot of two monitosrMy Raspberry Pi now has both a 7″ touchscreen and a 24″ monitor working at the same time. Most work is done on the big screen but the smaller display is for testing. I’ve reconfigured it so the menu is on the bigger screen, it makes more sense.

For quick and dirty screen shots, I use scrot (the name is derived from SCReenshOT). I’m fairly certain this was included with the operating system as it was installed, it wasn’t anything I added. What I didn’t expect was that it would capture both screens and put them in the one image. It fills the gap with a copy of the smaller screen.

Scrot is fine for most stuff but I thought that if I wanted to capture things like menus then I was going to install another utility that offered a time delay but digging a bit deeper, it turns out that scrot can do that as well. As with most Linux programs,

scrot --help

Gives you a list of commands and there’s a -d (or –delay) NUM which pauses NUM seconds before doing the grab. Other options let you do a countdown (-c), capture with border (-b)  and you can even have it run another program (-e) on the screenshot. Handy if you had it running unattended on a cron job and wanted to email the grab.

There’s a bit more but I’ll leave that for you to investigate.

How to install VSCodium on a Raspberry Pi.

How to install VSCodium on a Raspberry Pi.

64-bit VSCodium running on a 64-bit PI.It was very easy.  This was onto my Pi 4 running 64-bit Raspberry Pi OS.

Go to the releases page on the vsCodium website, it’s on GitHub.  If you are running 32-bit Pi OS then you need the codium_1.46.0-1591900344_armhf.deb file (the number will most likely have changed).  For the 64-bit one, you need the codium_1.46.0-1591900344_arm64.deb.

When you click on the link it will download and ask if you want to keep it. It will then give you the option of opening it and select the archiver. That will install it for you.

After that, to run it from the command line just type codium.

Or as I just discovered. Look on the pull down menu, go onto accessories and you should see (probably near the bottom) VSCodium. Move the mouse over and right-click.You’ll see a popup menu with Add to Desktop and Properties. If you click the former, you get an icon on your desktop.

Raspberry Pi IconsScreenshots were captured with the Flameshot utility. It’s installed with sudo apt install flameshot. That’s the VSCodium and Flameshot icons.

 

Playing with 64-bit Raspberry Pi OS

Playing with 64-bit Raspberry Pi OS

Binary digits
From Pixabay.com

So after deciding I was going to wait until the 64-bit Pi OS was tested and ready for use, I changed my mind and downloaded the beta and installed it.

It ran ok, though as with any Beta there are bound to be little glitches. There’s a survey where they are interested in what the PI is being used for and it showed UNDEFINED for my Pi’s serial number, though

cat /proc/cpuinfo

worked fine and displayed it.

The display utility let me change my display to 75 HZ at 1920 x 1080 and then promptly crashed. After reboot though it was at 75 HZ.

My main reason for trying it out though, I was curious about development tools, particularly IDES. I had forgotten that code.headmelted.com, the alternative source for Visual Studio Code (my favourite) supported arm64 which is what the 64-bit runs.  I was able to install VS Code from there without any problems.

64-bit vs 32-bit

32-bit has the memory limitation of 3 GB (in both Windows and Linux)  whereas 64-bit offers any amount of RAM up to what’s available. It’s not that big  thing with a 4 GB PI but with 8 GB it can make a big difference.  This article (Sorry that the link is to an article on Medium.com which offers a few free articles then paid) suggests that 64-bit Debian (which Raspberry Pi OS is) is quite a bit faster than 32-bit.  My impression is that it feels a bit snappier but that could be wishful thinking n my part!

I’ll put Asteroids on and see what fps I can get though that may not be a great way to compare them as the GPU plays a big part and I can’t see it making any difference, but I could be completely wrong on that. More as I investigate further.

Raspbian vs Raspberry Pi OS

Raspbian vs Raspberry Pi OS

Raspian.orgI’ve always referred to the version of Debian running on a Raspberry Pi as Raspbian and so it was until the recent 8 GB RAM Raspberry Pi was launched.  But it turns out that Raspbian was an independent version of Debian created by people at raspbian.org.  As they say “Note: Raspbian is not affiliated with the Raspberry Pi Foundation. Raspbian was created by a small, dedicated team of developers that are fans of the Raspberry Pi hardware, the educational goals of the Raspberry Pi Foundation and, of course, the Debian Project.

From now on, it seems the correct name is Raspberry Pi OS and no longer Raspbian. The change was announced at the bottom of this Raspberry Pi Foundation blog post. This has something to do with the fact that Raspbian is mainly 32-bit while the Raspberry Pi OS is both 32-bit and 64-bit though the latter is still at beta. You can read more about the recent changes to Raspberry Pi OS on this blog entry.