Controlling a Canvas app using a USB Gamepad

In Pirates 365 we want to control the awesome Canvas App Game with either a USB Gamepad or a Steering wheel.

Seemed like a great idea

Controlling a Power App using a wheel or gamepad not that easy. Power Apps doesen’t have event listeners from keypress-events. There are several forum- and blogposts that are mentioning this, but it seems like nobody had any really good solutions for it.

We had several ideas to make this work

  • Map gamepad klicks to keyboard events
  • Map gamepad klick to mouse clics
  • Create a Browser addin that listen to the keyUp event and by javascript find the Power Apps left/right buttons in the DOM and click them.

The solution we went for was mapping the gamepad to keyboard presses.We found an application AntiMicroX where it was possible to map gamepad presses to key-presses on the keyboad.

We mapped left click on the gamepad to “Space”, and up to “tab” – making it possible to toggle between the different power apps buttons

Demo of the solution

Her we can see that we are moving the ship with the gamepad – emulating clicks on power app buttons

Badges 🤩🥳

  • We thing this may be awarderd the “Nasty Hacker” because it is…..hacky
  • We think this may be awarded “Embedding numbnut since we are attaching “things that can flip bits”

The Orange Bandits’ fleet tracking

The Orange Bandits’ operation center is need for a mechanism to track vehicles to get more insights about ongoing looting operations. A raspberry pi with a tracking device is the first solution that comes in mind!

Yes, it is mobile! With a power bank it is!

Though, this is not a straightforward solution. Some Python code is due at this point. Unfortunately, The Orange Bandits owns an old Raspberry pi with an old SD card that doesn’t tolerate new updates; not retro enough! Well, we had to use an old version of Python to get this to work!

Hipster and retro 😉 😉
Oh yeah! That’s retro

Embedding a device that flip bytes is not an easy ride. We need to come with innovative ways to to keep it online and to keep the GPS tracker in the “Chinese” satellite signal range!

Here is proposed solution to keep the device connected
Here it is spitting location data (longitude and latitude)

Embedding numbnut

This post demonstrates how you can connect different hardware with logic to create good vibes🎵

We have a proximity sensor that speaks Zigbee. It is a “boolean” with the statuses of Open or Closed.

The proximity sensor is then connected to a Raspberry PI that is running software to interpret the signals sent from the proximity sensor.

The raspberry pi is then connected to the Sonos, and each proximity sensor distributed around the area will have its own songs playing when you trigger them.

Based on the excelent suggestions from the Judges, we have:
Wierd Al Yankovic, Motorhead and Less than Jake👏🎵😂

Integrations and external data!

When you are a pirate, it is pretty usefull to know what kind of weather it is, right? And, when you first have your own Awesome Pirate Corp. app, this information should of course be available here (we know, it’s cold to be a Norwegain Pirate right now!):

To do this, we created a flow that gets your location data when you use the PowerApp, goes out and gets the weather where you are, and pushes it back to the PowerApp to show you:

They see me flowin’ 🏴‍☠️🦜

When we need to merge things together, what could be easier than using Power Automate.
We have seen that there is a need for visual warning on board ships to be ready if pirates are coming.

Power Automate flow for Hue lights
Triggered 🤔


Therefore, we have connected a Zigbee light chain to a Philips Hue base, on which we use a Power Automate flow to activate a red alarm light.
This is done by calling an endpoint with ALERT in the body.
When the coast is clear again, we can send a “no danger” message and the light will return to green.
It is solved by calling the same endpoint with CLEAR.

Some code for sending alerts to Teams and lights

To make this work, we have connected a Raspberry Pi to the same local network as Philips Hue. We have used a Philips Hue connector from an independent developer.
Fine with everything that is ready-made from 3rd parties 😃

Raspberry PI connecting it all together

Embedding Numbnuts

Alarm System

Turtles HQ was in dire need of a solid security system. Being in the sewage system underground they decided that tripwires was the absolute best way to achieve wanted level of security.

When the magnet is tripped/removed (white item on right side of picture, a signal is sent to Raspberry PI that starts a flow. This is a on/off trigger.

If the Trap step notices a change, the node is checked for status on/off. If is is ON, it will call the service that activates full alarms for the Turtles HQ. Alarms visual and audio are full blast.

Pizza Order

The Pizza delivery has also been equipped with sensors that notify when a pizza has been delivered. When the pizza has arrived at the spot, a signal is sent via Zigbee to raspberry pi, and from here it changes the light to Green for a successful delivery.

Kjøleskapet kan se pt. 2

Nå har vi bygget videre og kommet opp med et mye mer robust kjøleskap. Flytteesker kan brukes til så mangt 😎 Fortsatt en del testing med forskjellige frukter (man tager hva man haver). Responsen er så som så, men vi er på god vei. Klementin ble tidligere eple (ref. https://acdc.blog/in2022/kjoleskapet-kan-se/), nå er appelsin appelsin, og eple er eple 🎉

Her har vi en appelsin innendørs i et kjøleskap med både vegger og gulv. Imponerende? Yes!!!
Og her er hva som ble tatt bilde av. 1-0 til AI

Oppsettet er som følger:
Webkamera montert i kjøleskapsdør, koblet til Raspberry PI.
Arduino med knapp (les mye frustrasjon med KNAPP!!!!) som trigger kamerabilde ved åpning av kjøleskapsdør.
Arduino styrer i tillegg en trinnmotor som spinner en kul 3D-printet bling på toppen av kjøleskapet (bling kommer, men se bilde).
Alt på Arduino styres av den samme Raspberry PI’en ved hjelp av Python.
Når bilde er tatt, sendes det til Azure Cognitive services for analyse, og responsen kommer som oppdagede objekter. Deretter matcher vi dette med vår egen ingrediensdatabase i Dataverse via en Power Automate flow (kjøres via en HTTP request trigger i flowen) som oppdaterer ingredienser med attributtet “In fridge” = True/False.

Bildet under viser flowen som trigges fra kjøleskaps-raspberryen. Deretter oppdateres status på hva vi har i kjøleskapet. Dette er deilig å slippe og gjøre manuelt.

Her har vi integrert rubbel og bit, og det fungerer!

Det vi frykter nå er at maskinene skal vende seg mot oss, og si at kjøleskapet er tomt til en hver tid. Da kan vi risikere å sulte i hjel foran kjøleskapsdøren.
Men inntil videre velger vi å stole på vår kjære Fridgitoid 9000