Sample Code: XRP Fortune Teller

I just finished a new Blockly example code. This one turns the XRP into a Fortune Teller. It is available at XRP Blocks - Google Drive.

You can set the XRP on a standard 30" deep folding table. Then press the Reset button and the XRP will drive to one of three destinations on the other side of the table.

You can use this like a Magic 8-Ball or Zoltar machine. Guests can ask it a Yes or No question and it can drive forward to a sign with “Yes,” “No,” or “Maybe” to give them their answer.

You can also use this like a wheel of fortune. If you have different items to give away, each destination can have one of them available. Guests can start the XRP at a starting position and it will choose which one to go to.

Right now there are five paths programmed. There are 2 that go to the left, 2 that go to the right, and 1 that goes to the center. The more expensive prizes can go there. Or you can add another IF block with the Center block to even out the odds.

Right now I have a blink block in to display which path the XRP will follow. This was primarily for my debugging so I could tell if the random block was working and verify that the paths went where I wanted them to go.

The code was built on top of the XRP Logo code, so building out new paths should be pretty easy. I also added an inches to cm converter because I knew that a standard folding table is 30" deep and it was easier for me to design paths in inches than cm.

1 Like