The Badge WX is a pre-built BlocklyProp adventure platform. It is easily programmable to show your name and to interact with other people you encounter at an event. It has sensors, a display, LEDs and audio output for customizing to your preferences. Its pre-built features take you straight to the programming without any circuit building.
The Propeller multicore microcontroller is the tiny computer chip brain on the Badge WX. The Propeller is easy to program with BlocklyProp, a fun, visual environment to build your code projects piece by piece, using blocks. BlocklyProp is Parallax’s adaptation of Google's open-source Blockly tool, fully customized for the Badge WX and other Parallax Propeller boards.
If you have some experience with programming, robotics, or Blockly, that's great! But if you do not, don't worry because it is not required here. Either way, it's best to go through this introduction before moving on to other BlocklyProp examples.
The Badge WX is programmed wirelessly over WiFi. You will use your computer to reach blockly.parallax.com, and a WiFi access point to program the Badge WX. Your computer and access point must be on the same network, and the WiFi access point must allow devices to interact with each other on its network.
Most home WiFi routers ship configured in a way in a way that's ready for wireless dowloading to the Badge WX. Corporate or educational WiFi access points may have more restrictive access. Unless you know your WiFi access point has restrictive security settings, you may initially skip this section and come back to it if needed,
If you are unable to access your Badge WX via WiFi through your router, update your router settings:
*Bridged mode good, sandboxing bad: Most home network access points are naturally in bridged mode, giving each connected device access to the same subnet and to each other. However, many commercial or educational access points, and some mobile phone hotspots, do not operate in bridged mode. In addition, they may implement separate device isolation—sandboxing—making it impossible for your computer to talk to other devices, such as your Badge WX.
**Policy pages won't work: Some commercial or educational access points, often those with an OPEN security setting, may associate successfully with your Badge WX but then stop communiating. These access points serve up a web page requiring the user to sign in and/or agree to stated policies before continuing. Such access points are incompatible with the Badge WX.
To program the Badge WX you will need to register an account on blockly.parallax.com. This allows you to create and save your programs (and share them with others, if you wish). Once you have registered, you will log in each time you return to continue with saved projects or create new ones. To register:
Once you have entered all of the necessary information, you should see this message:
NOTE: If you are a teacher and your students are using a school email address, please ask your IT Department to white-list the parallax.com domain. The accounts are confirmed and activated through the email provided at registration. See the BlocklyProp FAQ for Schools [3] for more tips and details.
The next thing you will need to do is install a little bit of software on your computer to interact with your hardware.
A page will open with download links for your detected operating system. You can also click "Show options for all operating systems" to view more choices.
The FTDI USB drivers are required to download code to your Propeller board. You may need to restart your computer for the USB drivers to work.
Congratulations! You are now ready to return to the BlocklyProp homepage. Time to connect your hardware and try some programming!
To make the Badge WX visible to BlocklyProp, you will need the WiFi Access Point's login and password. You will enter this information right on the Badge WX, using the startup menu that automatically appears on its display, and the rocker buttons on the top edge of the board.
A few seconds later, if it successfully associated, the Badge WX will report "Connected!" along with the Wi-Fi Access Point name and the IP address it received.
The On/Off Button has many uses! You can read about them all in the Badge WX Product Guide. If you find your Badge WX is in a strange, unknown state and you want to start over, just press the On/Off button again; you should see two slow blinks and then it will turn off. If the PWR LED is already blinking, wait for it to stop before trying to turn it off. Button presses are not recognized while the PWR LED is lit (on).
In BlocklyProp, programs are often referred to as projects. You need to define the project’s attributes before you start coding.
In the toolbar, click New project, and this window will open:
The BlocklyProp workspace starts out blank. To the left of the workspace is a category menu of BlocklyProp blocks (note that these are updated periodically). Clicking items with an arrow will open a sub-category menu.
To build a program, you will click, drag, and drop these blocks into your workspace in the order they need to run. Blocks placed near each other that are meant to fit together will snap into place with an audible click. You can click, drag, and drop to separate them again if needed. Many blocks have entry fields and drop-down menus you will use to choose how the blocks behave. Some blocks are designed to fit inside other blocks and work together.
Your Badge WX is locked to prevent programming each time the power is cycled off and turned back on. This is to prevent hackers from causing mischief. To start programming your Badge WX, you must manually unlock it first. There are two ways to unlock the Badge WX using its buttons, 1) persistent unlock, and 2) one-time temporary unlock.
Persistent unlock (recommended)
This method will keep the Badge WX unlocked for programming until you turn it off and back on, or until you use a Badge WX Programming Lock block.
One-Time temporary unlock
After power-up and connection to a Wi-Fi Access Point, the Badge displays the "Connected!" message, as yours should now.
The Badge WX will display the "WiFi Programming activated" screen. The Badge WX can now be programmed, but will lock again automatically a few seconds after you run your code. Further download attempts will fail since the Badge WX was only unlocked for a single download.
Run Once (load code to RAM)
Load and Run (save code to EEPROM):
This First Program example code displays data on the Badge's OLED screen, first the word " Badger!" and then numbers counting from 1 to 100. If it hadn't displayed data, the screen would still show whatever was on it before the code download, such as the "Connected!" or "WiFi Programming Activated!" message, depending on how you unlocked it. So, it is a good idea for your projects to include some sort of OLED message, even if it is just "Done!" so you know your code did run.
Some blocks are relatively straightforward to use. Others might need a bit of explanation to figure out what they are for, and how to use them.
Try finding the Help information for the blocks in your program.
The Help option will take you directly to the page inside the Block Reference which provides details for that specific block, including an explanation for each of the block's fields. Pay attention to any Info or Warning boxes you come across - it will save you trouble later! (Note: You can also navigate here under Support > Reference.)
Let's explore the additional block options available from the right-click drop-down menu.
When you right-click in the workspace, there is a Delete ... Blocks option in the drop-down menu that comes up. This selection will delete ALL the blocks in the workspace! A pop-up menu asks you to confirm this is what you want before the delete. If necessary, right-click in the workspace a second time to select Undo
If you have been following this tutorial from the beginning, you should have two Blockly programs, the second one made with the Save Project As option from the toolbar's drop-down menu. Let's look at some other options in this same menu. Most of them cause you to navigate away from your workspace. You will see a pop-up asking if you want to do that, reminding you to click Stay and save your changes first.
The SVG file stamps your project with your username, the project's title, its Project ID (also used in the SVG file name) and the Propeller board that is the project's target. From the SVG file, you won't be able to edit the project or program your Propeller with it. But it does have two useful purposes for advanced users:
User libraries: BlocklyProp has a define function block that creates a named wrapper around a custom set of blocks that you would like to re-use frequently. You might create a group of related functions in a custom "library" project and download the SVG file. Then, you can later upload and append this "library" to your future projects to access your favorite functions. Kind of like making your own BlocklyProp Bookmobile, if you will.
Lessons plans and handouts: If you are a teacher, the SVG files give you an option for organizing and archiving your lesson plans and assigning template projects to your students without making them community projects.
Demo if you dare: If you want to participate in the ongoing development of the open-source community project that is BlocklyProp, you may find yourself at demo.blockly.parallax.com. This site is where new blocks for various Parallax devices and new features are tested and tried before being promoted to blockly.parallax.com. Note, however, that if you create a project on the demo site, it stays there in the demo universe. If you save your demo projects as SVG files, then you may be able to upload them to the production site if/when their blocks go "live."
Links
[1] http://www.parallax.com/product/20300
[2] http://blockly.parallax.com
[3] https://learn.parallax.com/support/download/1741/blocklyprop-faq-schools
[4] http://learn.parallax.com/tutorials/language/propeller-c/propeller-c-set-simpleide