LEARN.PARALLAX.COM
Published on LEARN.PARALLAX.COM (https://learn.parallax.com)

Home > Propeller BlocklyProp Block Reference

Propeller BlocklyProp Block Reference

Language Reference

For the Activity Board WX, AB360° Robot, FLiP Try-it Kit, Badge WX, and other Propeller boards. For the Scribbler S3, see the Scribbler S3 Robot Block Reference. [1]

Browse by topic or block category using the menu on the left.  Or, in the BlockyProp editor, right-click any block and choose "Help" to go right to the block's reference page.

Open the BlocklyProp online programming tool. [2]


Getting Started Guides

Getting Started with BlocklyProp [3]

(For the Activity Board, AB360° Robot, FLiP Try-it Kit)

Getting Started with the Badge WX and BlocklyProp [4]

Getting Started with the Scribbler S3 Robot [5]

Scribbler S3 Robot Block Reference [6]

NEED HELP??? If you get stuck, contact Parallax Tech Support: email support@parallax.com, or call 888-997-8267 (USA only) or 916-624-8333. 8-5 M-F. Pacific Time. The BlocklyProp FAQ for Schools [7] may also be of help installing BlocklyProp.

About Board Types

Why Board Types?

Every time you create a BlocklyProp project, you are prompted to choose a board type. The board type setting changes:

  • the set of blocks available for program-building
  • the menus, ranges, and configuration options for available blocks

Each set of blocks is custom-fit to work well with the built-in accessory circuits on its particular board.  This helps to avoid accidentally misusing the I/O pins connected to a board's accessory circuits.

Can I change my project's board type? — NO! Once you have created a project, you cannot change the board type chosen.

Can I upload a blocks file from one board type into a project for another board type? — MAYBE. If you try to upload a BlocklyProp Project .svg file to a project of a different board type, you will see an error message. You can override the message and proceed, but the operation is still likely to fail unless all of the blocks in the project are 100% identical in functionality between the two board types. It is usually best to view the .svg file as a reference for re-building the project with the correct board type.


Propeller Activity Board WX

  • Propeller I/O pin range restricted to P0-P17 on many blocks, and even as low as P13, to protect built-in circuits and ActivityBot applications.
  • Analog/Pulses > Voltage > A/D and D/A are exclusive to this board type.
  • Sensor > 2-axis Joystick is exclusive to this board type (as it uses this board's A/D).
  • Audio > WAV blocks play files stored on a card in this board's built-in microSD card slot.
  • Robot  > ActivityBot 360°, ActivityBot, and Arlo blocks are exclusive to this board type.

Propeller Activity Board WX Guide [8]   Propeller Activity Board Guide [9]


Propelller FLiP or Project Board USB

These all-purpose boards have almost no built-in accessory circuits.

  • Excludes blocks that use board-specific built-in accessory circuits (such as the 2-axis Joystick that uses the Activity Board's built-in A/D converter).
  • Only Robot Initialize block option is Servo Differential Drive
  • No Propeller I/O pin restrictions on P0-P27.
  • Includes Analog/Pulses > Voltage blocks for common ADC DIP chips.

Propeller FLiP Guide [10]  Propeller Project Board USB Guide [11]


Scribbler S3 Robot

See the Scribbler 3 Robot Block Reference [1].

  • Most blocks are specific to the Scribbler S3 robot, so it has its own reference [1].
  • Excludes access to most Propeller I/O pins except for those few in the Hacker Port section.
  • Sensor blocks limited to built-in sensors, the Ping))) sensor, and decoding Sony remote signals.
  • Motor blocks support the Scribbler's built-in motors and a Standard Servo.

Scribbler S3 Info Poster [12]


Hackable Electronic Badge

  • For our original Hackable Electronic Badges (20000, 20100, and 20200) with a USB micro B port for programming.
  • Excludes most blocks with direct Propeller I/O pin access.
  • Sensor blocks are a special set only for this badge's built-in sensors.
  • Communicate blocks include IR communication and Badge display blocks specific to our badges' OLED screen.
  • Blocks don't work on other non-badge board types, and some may be unique to this specific badge.

Hackable Electronic Badge Guide [13]


  Badge WX

  • For our Badge WX, which is programmed wirelessly via onboard ESP8266 WX WiFi module.
  • Excludes most blocks with direct Propeller I/O pin access. Note that Propeller I/O pin assignments are different from those for the original Hackable Electronic Badges.
  • Sensor blocks are a special set only for this badge's built-in sensors.
  • Communicate blocks include IR communication and Badge display blocks specific to our badges' OLED screen.
  • Audio > WAV blocks play files stored on a card in this board's built-in microSD card slot.
  • Some of its blocks don't work on other non-badge board types, and some may be unique to this specific badge.

Badge WX Product Guide [14]


Other

"Other" is the catch-all category for boards with a Propeller P8X32A microcontroller module that is not otherwise on the list.  There are three major differences in this category:

  • Excludes blocks that are designed for board-specific peripheral circuits.
  • No I/O pin restrictions placed on any blocks.
  • Includes the System category of blocks.

The System category of blocks generally requires some familiarity with text-based programming and the Propeller P8X32A chip architecture for successful use. 

Propeller P8X32A Datasheet [15]

About Naming Things

Naming Things in BlocklyProp

In BlocklyProp, all named constants, variables, arrays, and functions are global, meaning that they can be accessed from any other point in a project at any time.  If you'd like to add constants, variables, functions, or arrays to your project, you will need to make up your own names when using these blocks:

define constant [16]

 

variable set [17]

 

array Initialize [18]

 

define function [19]

 

 

The Rules for Naming Things

Following the rules of naming is very important when using these blocks!

  • Use a unique name for each constant, variable, array, and function used in your project.  Do not try to give a function and a variable the same name, for example.
  • Names are case-sensitive, so be consistent with capitalization. To BlocklyProp, foo and Foo are two different names!
  • By C-language convention, constant names use all capital letters.  So, BlocklyProp automatically transforms each constant name you enter to all-caps.  That helps to tell apart variables and constants when reading your code.
  • Make a habit of using letters, numbers, and underscores only. BlocklyProp will replace "illegal" characters, including spaces with underscores. However, in general, its good to practice not using illegal characters, as they won't work in C and many other languages. 
  • Begin names with letters only. Names cannot begin with a number; it will cause a compiler error. Do not use underscores at the beginning of names as this may cause conflicts with the names used in BlocklyProp's underlying C code.

You may get a compiler error message when you try to run your project if you happen to use a name that is the same as a C reserved word. The BlocklyProp system attempts to compensate for this by beginning its names with double-underscores, but there are still exceptions that get through and cause trouble.

If you see compile error messages that say something like
    "error: 'name' redeclared as different kind of symbol" or
    "note: previous declaration of 'name' was here"
...try renaming your variable.

About Multicore

The Propeller chip is a multicore microcontroller - it has eight processor cores inside that can run different pieces of code at the same time, sort of like having eight different brains working on individual tasks for a project. 

When creating a Blocklyprop project,  the main code you build runs in one processor.  The BlocklyProp Functions and Multicore tutorial [20] explains more about how this works.

Blocks that Launch Processors

Throughout the Block Reference, look for this "brain" icon as an indicator that a block launches one or more cores automatically. See each block's reference for details

  • CONTROL [21]
    • new processor, +1 per block used.
  • SERVO [22]
    • standard servo, + 1, using up to 14 instances of this block will not launch additional processors.
    • CR servo, + 1,  using up to 14 instances of this block will not launch additional processors.
  • ROBOT [23]
    • robot init, +1, use one block per project.
    • abcalibrate, +1 use one block in a stand-alone project with no other blocks.
  • SENSOR
    • ColorPal [24] > ColorPal Init. +1 per block. May use more than one block per project.
    • GPS [25] > GPS init, +1.  Use only one GPS init block per project.
    • Sound Impact [26] > Sound Impact initialize, +1.  Use only one block per project.
    • RFID [27]> RFID Initialize, +1. Use only one block per project.
  • COMMUNICATE
    • Protocols [28]> Serial initialize +1 per block instance.
    • RGB LEDs [29] > RGB-LED init +1 per block instance.
    • XBee [30]> XBee init, Use only one block per project.
    • WX Wifi > Advanced [31], Advanced WX Init, use only one block per project.
  • ANALOG/PULSES
    • Voltage [32]> D/A Channel, +1, whether using it for one or two channels.
    • PWM [33]> PWM Init, +1, Use only one block per project.
  • AUDIO [34]
    • WAV files wavplayer +2 (uses 2 while playing, 1 between tracks).

 

About BlocklyProp Updates

BlocklyProp Updates January 25, 2019

  • Updated the BlocklyProp core provided by Google, to fix a core bug related to variables. This slightly changed the process for creating variables. See the Variable Blocks [35] tutorial.
  • Expanded the options in the Color Picker menu.

BlocklyProp Updates Released November 12, 2018

Bug fixes and improvements

  • Serial LCD send command block - fixes bug causing it to not generate any code
  • Improve User Defined Code block - allows copies of a block to work in the same project
  • String scan multiple block - fix bug where user input would not save
  • String operator blocks - improve and fix generated code
  • Fix bug related to variables containing strings
  • Add blocks and improve output pin selection for WAV, text-to-speech, and Sound blocks
  • Add "other" or constants for defining pins in most protocol and sensor blocks

BlocklyProp Updates Released September 5, 2018

New devices

  • New Badge WX board/device type
    • Includes blocks and libraries to support the Badge WX
  • Supports Parallaxy robot within the Propeller Activity Board WX board/device type
    • Allows direct-load of base firmware and calibration specific to the platform

New/improved blocks

  • User-defined code block
    • Allows the user to create a block that generates user-defined code
  • New blocks and improvements to existing blocks in Operators > Strings
    • Allows for cleaner manipulation of strings, reduces the likelihood of memory and compiler errors.
    • Strings in Blockly changed from 1-referenced entities to 0-referenced entities.
      • Blocks that "1-referenced" strings are now deprecated (see About Deprecated Blocks below)
  • Send multiple and receive multiple blocks added to all communication devices/protocols (and string operators)
    • Allows for floating point to/from integer in to and out of the Propeller
    • Allows generation of more complex string and number combinations
  • Fixes XBee block errors and bugs
  • Adds Advanced WX blocks for interacting with the WX module on WiFi networks
    • Potential Internet of Things (IoT) applications
  • Adds “to”/”thru” option to the repeat x times block
  • Adds SD card blocks for text file manipulation
  • Improves/simplifies IMU (LSM9DS1) magnetometer calibration routine
  • Adds named constants blocks
    • Better than variables for defining things like Pins.
    • Unlike variables, named constants do not use memory.
  • Adds sound blocks
    • Can be used for polyphony
    • Can be used to generate DTMF tones
  • Adds wav set pins block to Propeller ActivityBoard WX board/device type
    • Allows .wav files to be played out to breadboard pins instead of the earphone jack

Improvements to Propeller C generated code

  • Detects variables shared across processors and declares them volatile
    • Prepares BlocklyProp for user-selectable compiler optimization (to be released in a future update)
  • Improved string variable code generation
    • Generates string variables that are cleaner that won’t collide in memory
  • Cleaner Propeller C generation
    • Several Blockly-generated functions have been moved inside of simpletools.h
    • More concise, readable code
  • Improves 4x4 keypad block generated code
    • Solves button “bounce” and inconsistent/incorrect readings

System/User interface improvements

  • Adds X-Y series (scatter plotting) to graphing blocks
    • Allows for direct comparison of two (or four, six, eight, or ten) input quantities.
  • Overall code efficiency improvements, as well as improvements designed to support offline use in future versions.
  • Database and project code improvements
    • Deceased load on server databases - reduces project load time
  • Server upgrades
    • Eliminates an overloading error that caused site downtime on rare occasions
  • Split server-side and client-side code into separate repositories
    • Allows for smaller, more frequent updates
    • In preparation for a future offline version of BlocklyProp

BlocklyProp Updates Released May 24, 2018

  • ActivityBot 360° is now the default option for Robot initialize, ActivityBot calibrate, and ActivityBot display calibration blocks.
  • Community Projects: the former Sharing options Private and Shared have been updated to List in Community Projects options Unlisted and Listed.
  • Share project using link checkbox for new projects creates a permanent link for that project.  The link can be activated, de-activated, and re-activated with this checkbox.
  • Terminal character echo now takes place in the Terminal itself, not in the Propeller chip, for improved performance.
  • SimpleText in the library the Terminal print text blocks updated to better handle new lines (/n) and carriage returns (/r).
  • The Project description field has been shortened so the buttons underneath are visible on lower resolution screens.
  • Connection checking functionality has been temporarily disabled for XBee and Serial protocol blocks pending planned improvements. An incorrectly structured code may not compile but alleviates a bug that prevented users from being able to re-open saved projects that used specific blocks.

About Deprecated Blocks

Occasionally, we "retire" blocks.  Sometimes we integrate a block's functionality into a related one, to reduce the number of blocks. Other times, we may need to replace the code that a set of blocks generate, in a way that is not backward-compatible and so would "break" existing programs. Then, we "retire" the old set when we release the new set.

When a block is deprecated, it will turn orange to alert you that it is time to update that spot in your code with a current block.

Blocks deprecated June 27th, 2018

  • find substring (1-referenced version)
  • get character at (1-referenced version)
  • set character at (1-referenced version)
  • get substring (1-referenced version)

Blocks deprecated January 18th, 2018

  • Serial transmit number and Serial transmit text — to be replaced with an improved Serial Transmit block that handles both text and numbers
  • Serial receive text and Serial receive number — to be replaced with a block that handles both text and numbers

Released January 19th, 2017

For the best experience, Windows and Mac users should update their BlocklyProp Client software to version 0.7.x or higher, but anything in the 0.6.x range will work.

  • Map, a new number operator block scaling and offsetting a value from one range to another — great for tying sensor or human input to actuator output
  • Math operation block updated to support additional terms - just click the gear icon.
  • Parentheses block, to change the order of operations in math operations
  • Music note, a new value block to specify a frequency by note and octave
  • Terminal print multiple, OLED print multiple, and LCD Print multiple: each device has a new block for printing a list of terms of different types such as a text label followed by a decimal value, on a single line
  • Scale and display integers as floating point decimal values with the Terminal, OLED, and LCD print multiple block
  • New Serial transmit and Serial receive blocks that can handle both text and number values (deprecating the current blocks, see below.)
  • Additional Serial Init options for customizing the baud rate and mode
  • Multiple device support for RGB LED init, ColorPal init, and Serial init connections
  • Advanced options in the Feedback 360° servo configure (formerly setup) block
  • Feedback 360° servo status, a new block to support applications that require coordinated movement among several servos at once
  • The option to specify the PIN in certain SERVO and ANALOG/PULSES blocks with another block instead of a drop-down menu
  • Improved instructions for launching your BlocklyProp Client/Launch if not found
  • All projects created as private by default, even when using the "save as" feature with your own shared project or with other user's community project.

Released October 2017

  • Feedback 360 servo blocks for the new Parallax Feedback 360 High-Speed Servo [36]
  • Updated Robot blocks to support the ActivityBot 360° robot [37] in the Robotics with Blockly [38] tutorial.
  • Deprecated PWM Initialize block; its functionality was incorporated into the PWM set block.

What we are working on next

  • Wireless Terminal support via WX WiFi modules
  • An offline version of BlocklyProp (Windows/Mac/Linux only)
  • Searchable and sortable project listings
  • User and project preference settings
  • Propeller C editing capability within BlocklyProp
  • Support for additional devices and sensors
    • one-wire thermometers
    • parallel character LCDs
    • digital potentiometer
    • real-time clock modules

We strive to coordinate our updates to keep all of our tutorials up to date with the very latest changes in BlocklyProp once they are released. However, due to the volume of the tutorials and educator resources, there may be some unavoidable lag time.

Change History

For all the gory details, see our BlocklyProp-related GitHub repositories:

BlocklyProp website [39],   BlocklyProp server [40],   BlocklyProp client [41],   Propeller Cloud Compiler [42]. 

Control

BlocklyProp reference for CONTROL blocks

  Compatible with all Propeller Board types.

The CONTROL blocks in BlocklyProp are used to build the structure of a Blockly program.  Use these blocks to repeat, loop, make decisions, build and use functions, and start up new processors.


add comment

The add comment block will add a comment or note to the program. This block has no effect on the way the program runs. It is simply a way to write a note in the program to help others understand the program.


if...do

The if...do block is for decision-making: if the condition inserted at right is true, the enclosed code in the do section will execute. If the condition is not true, the do section will be skipped over and not executed.

The if...do block is a mutating block, indicated by the gear that can be clicked. It allows the block to include multiple “else” and “else if” conditions. If the first condition is not true, its enclosed code will be skipped and the next else if or else conditions will be evaluated and executed if true, before exiting the outer block.

If...then...elseif vs switch...case. The former is more familiar to many programs, but sometimes the latter is a better fit. See the video at switch...case below. Here's an example:

if...then always resolves the attached condition to true (1) or false (0).  Imagine a program that needs to determine which button is pressed on a remote.  if...then would be like trying to get information from a person who will only answer yes or no. Imagine  "Did you press button 16? No?  OK, then did you press button 17? No? Okay, well, did you press Button 18? Really? Okay, I'll keep trying..."  You may have to ask a lot of questions until you get a "yes" answer and know which action to take.

switch...case always resolves the attached condition to a number.  So, instead, you can simply say "What button did you press?" and then go straight to the correct action without further delay. So if...then is a great fit if you need to evaluate a series of conditions and figure out which one is happening.  And switch...case is a great fit when you have a variable or equation determining which action to take from a list of numbered choices.


conditional repeat

The conditional repeat block creates a loop that, depending on the option chosen in the menu, repeats forever, __ x times, until __, or while __. With the exception of forever, each of the other options requires a condition to be added that indicates when the loop should end.

  • repeat forever: loops forever.  Only a break block will escape the loop and move on to the rest of the program.
  • repeat __x times: put a block in here to provide the number of times you want the loop to repeat before moving on. Block options are anything that resolves to a number, such as number value, math operation, random, or use variable.
  • repeat until__: put a block in here with a condition to test. Code inside the conditional repeat will run until that condition is true (any number other than 0).
  • repeat while__: put a block in here with a condition to test. Code inside the conditional repeat will run while that condition is true (any number other than 0).

repeat item

The repeat item block creates a loop that repeats a certain number of times, starting with the from__ value and ending with the end__ value. To take larger steps between the start and end values, increase the by__ value.

Caution: If you are using a variable you already created for the repeat item, this block will reset it to be equal to the from__ value and it will keep changing the value of the variable each time it loops.


switch...case

  

The switch...case block looks at the value of the item attached at switch, jumps down to its matching case, and executes the code enclosed in that case's do section. Click the gear to add additional case conditions. The break option is selected by default. If it is not selected, the program will continue to execute the code enclosed by the cases below it until it runs into a checked break.  If a default is provided, it will execute the code enclosed in the default's do section if none of the other cases match switch's value.

Read about if...do...else if vs switch...case above, and watch the video below.


break

The break block will exit a loop and proceed to the next block in the program.


pause

The pause block forces the program to halt and wait for a specified amount of time before continuing on to the next block. Provide a number in ms (milliseconds, 1,000 per second) for the amount of time to wait.  This can be a number value block or any other block that resolves to a number.


new processor

Each instance of this block launches a processor automatically.

The new processor block launches a function into its own processor (cog). There are up to 7 processors available on the Propeller. See the BlocklyProp Function and Multicore tutorial [20] for details. Here are some tips for using the new processor block:

  • Only a single run function block can be placed inside this block.
  • Do not use functions that contain Terminal blocks; Terminal blocks and functions containing Terminal blocks can only run from the main program.
  • Some other blocks also launch their own processor automatically—look for the icon.  Be mindful that a total of 7 processors can be launched from one program.

return

The return block may be placed in an if...do statement inside of a function, to conditionally exit that function early and continue with the rest of the program. A return block is not necessary as the last item enclosed by a define function block.

Operators

BlocklyProp reference for OPERATORS blocks

Compatible with all Propeller board types (except Scribbler Robot)

BlocklyProp has two categories of operators: numbers that work with numerical values, and strings that work with text characters.

Numbers

BlocklyProp reference for NUMBERS blocks

Compatible with all Propeller board types (except Scribbler Robot). 

The NUMBER operator blocks can accept number value blocks, and any other operation blocks or sensor blocks that provide a numerical value.


math operation

The math operation block performs a mathematical operation on the inserted value blocks. Non-integer (fraction or decimal) results will be truncated to an integer. Choose an operation from the drop-down menu:

  • + addition
  • - subtraction
  • × multiplication
  • ÷ division
  • % modulus (remainder after division)
  • ^ (raise to the power of)

The math operation block has two terms by default. Click the gear and drag over additional terms as needed. THE LIMIT IS 26 TERMS.

Order of operations

  • Innermost, when operation blocks are nested
  • Raising to a power - use nested operations to raise a power to a power or you may get unexpected results. Switch to the code view to verify that the operations performed on the terms are what you expect.
  • Multiplication & division
  • Addition & subtraction

To change the order of operations, nest operation blocks inside each other, and/or use the Parentheses block (below).


limit

The limit block allows you to compare the inserted values, and use the highest or lowest value as chosen in the dropdown menu.


constrain

The constrain block prevents a value from being too large or too small before using it. Insert a value or variable item, and then enter the maximum and minimum values for the range you want that value to stay within before it is used.


de/increment

The de/increment block increases (increment) or decreases (decrement) the variable attached to it by 1.


random

The random block provides a random number between the first inserted low value and the second inserted high value. The first number must be smaller than the second number. If they are not in that order, the resulting random value may be unexpected, such as a number outside the range specified.


bitwise

The bitwise block performs a bitwise operation (& AND, | OR, ^ XOR, >> right shift, << left shift) on the two values inserted.


boolean comparison

The boolean comparison block performs a boolean comparison between the two inserted values and provides a 1/true or 0/false depending on the option selected (and, or, and not, or not).


not

The not block performs the selected operation on the value attached and provides the result. The options are:

  • not: provide the boolean (1/true or 0/false) opposite of the value attached to it. (Any number other than 0 provides a 0/false.)
  • negate: provide the signed value complement; for example, negate 9 provides -9).
  • abs: provide the absolute value; for example, absolute 9 and absolute -9 both provide 9.)

parentheses

The parentheses block surrounds the enclosed block(s) with parentheses. Use parentheses to change the order of operations in a series of blocks.


compare values

The compare values block compares two inserted values and provides a boolean value, 1 if the equation is true, and 0 if it is false. Choose the type of comparison from the drop-down menu:

  • = equal to
  • ≠ not equal to
  • > greater than
  • < less than
  • ≥ greater than or equal to
  • ≤ less than or equal to

map value

The map value block scales and offsets the inserted value from the first defined range to the second defined range.  This block does not constrain the value that you've entered.  For example, given the ranges as shown in the block above, if the value you enter is -5, it will output -10, because the block is asking the new range to be twice the original range.


advanced math

The advanced math block performs a trigonometric, exponential, or logarithmic function on the inserted values, and stores the result in a variable. Angles are in integer degrees, not radians. Options are:

  • the cosine
  • the sine
  • the tangent
  • the square root
  • e raised to the power
  • the logarithm (base 10)
  • the natural logarithm)

Since Blockly is working only with integer math, the block requires you to begin with a multiplier (the first inserted value). Although you could use 1 here, larger numbers make this block more precise.


inverse trig

The inverse trig block performs an inverse trigonometric function. The angles that this block calculates and stores are in integer degrees, not radians. Options are:

  • arcsine
  • arccosine
  • arctangent

Because inverse trigonometry operations usually are done on ratios (one number divided by another, the block requires you to input both the numerator and denominator of the ratio.  If you need the inverse trig operation of a single number, use 1 as the denominator (the second number).

Strings

BlocklyProp reference for STRINGS operator blocks

Compatible with all Propeller board types (except Scribbler Robot)

Several string operator blocks have older versions that have been depricated, and if your project contains any of these older blocks, they will appear orange in color. While they will still work, it is a good idea to replace those blocks with newer versions and adjust your code accordingly. Most of the depricated blocks were depricated because they treated strings of text as one-referenced entities (One-referencing is where the first character of a string of text would be counted as character number 1. Zero-referencing is where the first character would be counted as character zero). While one-referecing is easier to understand, it wasn't fully compatible with other blocks and code since C is a zero-referenced language. Never versions of those blocks are all zero-referenced.


string variable set size

The string variable set size block is used to increase or decrease the size of the variable that can hold strings of text. By default, string variables are set to hold up to 64 characters. By decreasing the size of your string variables, you can save memory. By increasing the size of your string variables, you can hold longer strings of text.

Use the gear icon to add additional variables to the list, and set the size of each variable accordingly. If you've defined a constant using the constant define block, you can set the size of your variable to that defined constant when you click on the gear icon.


compare strings 

The compare strings block provides a value of 1 if the comparison between two strings is true, and 0 if the comparison is false. The drop-down menu selection determines the type of comparison:

  • the same as
  • not the same as
  • alphabetically before
  • alphabetically after

The alphabetical comparisons are only alphabetical if the case matches - a capital “A” sorts differently than a lowercase “a”.


length of string 

The length of string block provides the number of characters in the string, or variable containing a string, inserted into the block.


combine strings 

The combine strings block combines the first and second string and stores them in the variable selected in the drop-down menu. The block uses a buffer, so it is safe to use this block to add text to the beginning or end of a string already stored in a variable.


find string location 

The find string location block provides the position of a substring within a larger string. The block gives a number value representing where the starting location of the substring is in the larger string. For example, if you use this block to find the substring “World” in the string “Hello World!”, the block would return 7 because “World” starts at the 7th character in the string.


get character at position 

The get character at position block provides the ASCII character [43] (a number value between 0 and 255) for the character found in the string specified in the drop-down menu at the position set by the number value block.


set character at position 

The set character at position block sets the ASCII character [43] (a number value between 0 and 255) for the character in the string specified in the drop-down menu at the position set by the number value block.


get part of string

The get part of string block stores the part of the string specified by the first drop-down menu from the start and end positions set by the number value blocks and stores it in the variable specified by the second drop-down menu.


split string

The split string block is used to split up a string separated by the defined character. Can be used more than once to extract multiple string parts.


trim string

The trim string block removes extra spaces at the beginning and end of a string of text.


string empty

The string empty block is used to test if a string is null or empty.


create string

The create string block is used for making a new string from attached values or text.

Use the gear icon to add additional values such as decimal, hexadecimal, or binary integers, ASCII characters, floating point numbers, or strings of text to the string.


scan string

The scan string block is used to look for and extract values or characters from a string. Use the gear icon to add types of values to search for and extract from the string such as decimal, hexadecimal, or binary integers, ASCII characters, or floating point numbers.


string to number (Deprecated)

The string to number block converts the inserted string from decimal, hexadecimal, or binary format into an integer number, then stores the number in the chosen item.

This block has been deprecated. Its functionality is now in the scan string block.


number to string (Deprecated)

The number to string block converts the inserted integer value into a string in decimal, hexadecimal, or binary format, and then stores the string in the chosen item.

This block has been deprecated. Its functionality is now in the create string block.

Values

BlocklyProp reference for VALUES blocks

Block availability varies by board type.


number value

Compatible with all Propeller board types (except Scribbler Robot)

The number value block is a value that is usually placed in or attached to other blocks that are expecting a numeric value. Any numeric value can be typed into the block. Non-integers will be truncated to integer values.  Any integer value from 232 to 232 -1, which is -2,147,483,648 to 2,147,483,647, can be entered into this block.


text string

Compatible with all Propeller board types (except Scribbler Robot)

The text string block is a string of text that is usually placed in or attached to other blocks that are expecting a string of text. Any text can be typed into the block. Some blocks limit the amount of text they can accept to 128 characters.

(Note: previous versions of this block lacked the quotation marks.)


character value

Compatible with all Propeller board types (except Scribbler Robot)

The character value block provides a numerical value from 32-126 based on the printable ASCII character selected.


music note

Compatible with all Propeller board types (except Scribbler Robot)

The music note block provides the frequency value of the selected note. This block may be used with the AUDIO > Frequency out block.

  • Choose the note desired from the first drop-down. The options include sharps/flats.
  • Choose the octave desired from the second drop-down. The range is 1 through 8.

binary value

Compatible with all Propeller board types (except Scribbler Robot)

The binary value block can store an entered binary number (base 2).


hexadecimal value

Compatible with all Propeller board types (except Scribbler Robot)

The hexadecimal block can store an entered hexadecimal number (base 16).


true/false

Compatible with all Propeller board types (except Scribbler Robot)

The true/false block provides a value of 1 (true) or 0 (false) depending on which is selected.


high/low

Compatible with all Propeller board types (except Scribbler Robot)

The high/low block provides a value of 1 (high) or 0 (low) depending on which is selected.


constant define

 Compatible with all Propeller board types (except Scribbler Robot)

The constant define block provides a named constant and gives it a value.


constant value

 Compatible with all Propeller board types (except Scribbler Robot)

The constant value block returns the value of a named constant.


color

Compatible with all Propeller board types (except Scribbler Robot)

The color block provides a 24-bit integer representing the color selected. The value provided is derived by the following formula: (Red << 16) | (Green << 8) | (Blue). In a 24-bit number, the left 8 bits represent the amount of red, the middle 8 bits represent the amount of green, and the right 8 bits represent the amount of blue.


color (Badge)

Compatible only with the Hackable Electronic Badge board type

The color (Badge) block is used with the Badge set RGB-LED block to specify the RGB-LED color.


color value from

Compatible with all Propeller board types (except Scribbler Robot)

The color value from block generates a 24-bit integer representing a color value from the red, green, and blue values (0 to 255) inserted.


get red/green/blue

Compatible with all Propeller board types (except Scribbler Robot)

The get red/green/blue block provides a value (0 to 255) representing the amount of red, green, or blue in the 24-bit color value inserted.


compare colors

Compatible with all Propeller board types (except Scribbler Robot)

The compare colors block provides a value from 0 (opposite) to 255 (identical) representing how close two 24-bit colors inserted are.


system counter

Compatible with all Propeller board types (except Scribbler Robot)

The system counter block provides the current system counter value at the moment it is asked for. The system counter increases by 1 for every system clock “tick,” and there are 80,000,000 ticks every second on the Propeller Activity Board (PAB) and PAB-WX. When the system counter reaches 4,294,967,295 it resets back to zero.

Arrays

BlocklyProp reference for ARRAY blocks

Compatible with all Propeller board types (except Scribbler Robot)


array initialize

The array initialize block creates an array variable and define the number of elements in that array. If you forget to use array initialize, the other array blocks will show you a triangle warning symbol as a reminder:

  1. Type in a name for your array variable (see About Naming Things [44] for the rules.)  The default name is "list."  All other blocks using your new array must have the name typed in exactly the same.
  2. Type in the number of elements your array will contain.

Now, your array variable will be accessible from any other array block that has the same name typed into it, such as the array get element block below.


array fill

The array fill block allows you to set multiple elements in your array using a comma-separated list of numbers.  All numbers must be integers.  Any decimal values will be truncated, and if there are more values typed in than there are elements in the array, it will only fill the available elements.  The elements are always filled in order starting with element 0 (zero).


array get element

The array get element block provides the value of the specified element.  The element to retrieve can be specified with either a number value block or any other block that provides a value, such as a get variable block.


array set element

The array set element block sets the element specified by the first inserted block to the value specified by the second inserted block.


array clear

The array clear block sets all of the elements in your array to 0 (zero).

Variables

BlocklyProp reference for VARIABLES blocks

Block availability varies by board type.


set variable

Compatible with all Propeller board types (except Scribbler Robot)

The set variable block allows you to assign an initial value to a variable. Once that is done, you can use this block to access any variable you have created to use it elsewhere in the program.

The variable named item is a system default. To create a variable:

  1. Click the new variable button at the top of the Variables menu, then type in a unique variable name and click OK. See About Naming Things [44] for the rules.
  2. Click the set variable block to put it into your workspace.
  3. In the block's dropdown menu, choose the name of the variable you created.
  4. Attach an initial value with either a number value block or a text string value block.

Now, any time you want to change the value of your variable in the program again, you can use this block and select its name from the item drop-down.  Your variable will also be accessible from any other block that has an item drop-down menu, such as the use variable block below.

See the Variable Blocks [35] tutorial for an example activity.


use variable

Compatible with all Propeller board types (except Scribbler Robot)

The use variable block provides the value of the variable selected in the drop-down menu when inserted into other blocks. A use variable block will be created and visible in the Variables menu for each unique variable you create in a project.


wxConnldx variables

  Compatible with the Activity Board WX and Badge WX only.

These four default variables become available under the Variables menu when the COMMUNICATE > WX Module > Advanced > Advanced WX connect block is placed into the BlocklyProp workspace.


wxEvent

  Compatible with the Activity Board WX and Badge WX only.

This default variable becomes available under the Variables menu when the COMMUNICATE > WX Module > Advanced > Advanced WX poll block is placed into the BlocklyProp workspace.


wxHandle variable

  Compatible with the Activity Board WX and Badge WX only.

This default variable block becomes available under the Variables menu when certain COMMUNICATE > WX Module > Advanced blocks for data handling are placed in the BlocklyProp workspace.


wxld variable

  Compatible with the Activity Board WX and Badge WX only.

This default variable block become available under the Variables menu when certain COMMUNICATE > WX Module > Advanced blocks that perform data handling are placed in the BlocklyProp workspace.

Functions

BlocklyProp reference for FUNCTIONS blocks

Compatible with all Propeller board types (except Scribbler Robot)

Functions and Memory: Creating and reusing functions in your main program can save on program memory.  However, calling functions with the new processor block sets aside 128 bytes of "stack space" each time - that is a portion of the Propeller microcontroller's memory - used to execute the function. If your function running in a new processor is exceptionally large with many variables and computations, it might exceed this stack space and give unexpected results.


define function

The define function block is used to build a function that can be reused.

  1. Enclose a group of blocks that you want to re-use with the function block.
  2. Next, give the function a unique name in the my function drop-down menu. See About Naming Things [44] for the rules.

Once you have created a function, a run function will be created for it and will appear in the Functions menu.


run function

The run function block runs the code inside of a define function block by the same name. This is may be referred to as "calling a function" or "making a function call."  You must first create and name a function with a define function block to generate a run function block.

You can use a run function block in two ways.

  1. Put a run function block in your main program.
  2. Attach a run function block to a new processor block. This will make the function run in its own processor, and at the same time, your main program can continue executing. EXCEPTION: Terminal blocks can only run from the main program.

Pin states

BlocklyProp reference for PIN STATES blocks

For Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.  I/O pin availability will vary with board type.


make PIN

The make PIN block sets the function and state of a Propeller I/O pin.

Select a Propeller I/O pin, 0 to 27*. 

  • Drop-down variant (top): select the desired pin number
  • Programmable variant (bottom): insert a number value block that evaluates to an I/O pin number in the range of 0-27.

Set the function and state with the second drop-down: 

  • High sets the pin to output +3.3V.
  • Low connects the pin as an output to Ground.
  • Toggle sets the pin to a high output if it was Low or to a Low output if it was High.
  • Input sets the pin as an input (which allows the Propeller to read the high or low voltage applied to the pin, and block current from going in or coming out of the pin).
  • Reverse sets the pin to input if it was output or sets the pin to output if it was input.

check PIN

The check PIN block reads an I/O pin as an input.  It sets the specified pin to an input and returns a 1 if the pin selected is high and returns a 0 (zero) if the pin is low.

  • Dropdown variant (top): select the desired pin number
  • Programmable variant (bottom): insert a number value block that evaluates to an I/O pin number in the range of 0-27.

set multiple pins

The set multiple pins will set the state or direction of a continuous group of pins at the same time. 

  1. From the first drop-down, select one of two options:
    • direction will allow you to set each pin individually to input (IN) or output (OUT).
    • state will allow you to set individual output pins to HIGH (+3.3 V) or LOW (0 volts - ground).
  2. From the second and third drop-down menus choose a continuous I/O pin range, lower to higher. The maximum range for the Propeller Activity Board is 0-13.
  3. On the second row, a dropdown will appear for all I/O pins in the range; set state or direction independently for each one.

You must first set a pin's direction to output (OUT) with one block before you set its state to HIGH or LOW with another block. Otherwise, it won't work!


Binary get pins

The Binary get pins block reads the input states of a contiguous group of I/O pins. The state of each I/O pin becomes a bit in a binary number, with the highest I/O pin number providing the most significant bit. 

You must first each pin's direction to input (0) with one block before you attempt to read the input states with this block. Otherwise, it won't work!


Binary set pins

The Binary set pins block sets the state or direction of a contiguous group of I/O pins. Each pin in the group is set by the corresponding bit in the attached binary value block.

  1. In the first drop-down menu, select one of two options:
    • states - when states is chosen, a 0 bit sets a pin to output low and a 1 sets a pin to output high.
    • directions - when chosen, a 0 bit sets a pin to input, and 1 sets a pin to output. 
  2. In the second drop-down, select the highest I/O pin number in a contiguous group of pins, and in the third dropdown, select the lowest I/O pin number. For example, P9 and P6 would make a contiguous group P9, P8, P7, P6.
  3. Attach a binary value block, and enter as many binary digits as there are I/O pins in the specified range. The left-most digit will set the highest numbered pin, and the right-most digit will set the lowest numbered pin.  Optionally, you may use any block that provides a value, and the pins will be set to the binary equivalent of that value.

You must first set a pin's direction to output (1) with one block before you set its state to HIGH or LOW with another block. Otherwise, it won't work!

Communicate

BlocklyProp reference for COMMUNICATE blocks

Block and I/O pin availability will vary with board type. Use care if accessing I/O pins connected to built-in accessory circuits on your board. Refer to your board's product guide for I/O pin assignment details.

Badge Display

BlocklyProp block reference for BADGE DISPLAY blocks

  Compatible only with the Hackable Electronic Badge and Badge WX board types

The BADGE DISPLAY blocks work with the black-and-white OLED screen built into the badges. This 128x64 pixel display uses a coordinate grid to define where text, numbers, points, lines, and shapes can be drawn on the screen. The coordinates start at 0 (leftmost column), 0 (top row) and increase to 127 (rightmost column), 63 (bottom row).

WARNING: The BADGE DISPLAY blocks can only be used from your main program. These blocks will not work if used inside function blocks that are then launched with the new processor block.


Badge display print number

The Badge display print number block is used to send numbers to the Badge module. Numbers can be displayed as a decimal, hexadecimal, or binary.


Badge display print text

The Badge display print text block is used to send text strings to the Badge module.


Badge display print multiple

 

 

The Badge display print multiple block can print several terms of different types on a single line. Click the gear icon to drag additional terms into the list, then attach appropriate values to the block. Options are:

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

Checking the specify digits block adds a fill-in field next to all attached number values.

Floating point number option

BlocklyProp uses integer numbers. The floating point number option allows an integer value to be displayed as a decimal number. Use its drop-down menu to divide the integer by a multiple of 10 to scale and display the number appropriately. The specify digits checkbox activates an additional field by each numeric term.


Badge display set font

The Badge display set font block is used to set the size of the text (i.e., small: 5x7, medium: 11x15, large: 17x23).


Badge display set cursor

The Badge display set cursor block moves the cursor to the row and column specified. The display on the The Hackable Electronic Badge and the Badge WX has 128 columns and 64 rows.

The cursor position will be the top left pixel where a subsequent block's text string or number will be printed, or where a shape's origin will be.


Badge display clear screen

The Badge display clear screen block clears the entire screen by setting all pixels to black.


Badge display rotate

The Badge display rotate block turns the contents of the screen 180°.


Badge display draw point

The Badge display draw point block sets the pixel defined by the first two value blocks to the color defined by the color block.


Badge display draw line

The Badge display draw line block draws a line from the first coordinate to the second coordinate in the color defined by the color block.


Badge display draw rectangle

The Badge display draw rectangle block draws a rectangle from the first coordinate (top left corner of the rectangle) to the second coordinate (bottom right corner of the rectangle) in the color defined by the color block. The "fill" checkbox sets whether the rectangle will be drawn as hollow or filled.


Badge display draw circle

The Badge display draw circle block will draw a circle whose center is set by the first two value blocks, and in the color defined by the color block. The "fill" checkbox sets whether the circle will be drawn as hollow or filled.


Badge display draw triangle

The Badge display draw triangle block draws a triangle from the first coordinate to the second coordinate to the third coordinate in the color defined by the color block. The "fill" checkbox sets whether the triangle will be drawn as hollow or filled.


Badge LEDs

BlocklyProp Block Reference for BADGE LED blocks

Block availability varies by Badge type.

Using any of the Badge RGB-LED blocks on the Badge WX will cause one processor to be launched automatically (one total, NOT one per block).


Badge RGB-LED setup

Compatible only with the Badge WX board type

The Badge RGB-LED setup block is used to tell the Propeller how many RGB-LEDs are connected to the Badge WX. The Badge WX has 4 RGB-LEDs built in and a pin available to connect more.


Badge RGB-LED set

Compatible only with the Badge WX board type

The Badge RGB-LED set block is used to specify the color for a specific LED.


Badge RGB-LED set multiple

Compatible only with the Badge WX board type

The Badge RGB-LED set multiple block is used to specify the color for a range of consecutive LEDs.


Badge RGB-LED update

Compatible only with the Badge WX board type

The Badge RGB-LED update block is used to update colors of all connected RGB-LEDs.


Badge LED brightness

Compatible only with the Badge WX board type

The Badge LED brightness block sets the brightness of a specified LED.


Badge set LED

Compatible only with the Hackable Electronic Badge board type

These Badge set LED blocks are used to turn the specified LED on or off.


Badge set RGB-LED

Compatible only with the Hackable Electronic Badge board type

The Badge set RGB-LED block sets the specified RGB-LED to a specified color.

Badge Lock

BlocklyProp block reference for Badge WX Lock block

Compatible only with the Badge WX board type


Badge WiFi lock

The Badge WiFi lock block has two functions, chosen by the drop-down menu:

  • unlock: sets the Badge to stay unlocked after being manually unlocked via the Badge WX's own menu, or via 6 quick On/Off button presses, until the power is cycled.
  • lock: prevents the Badge from being programmed until manually unlocked.

See the Badge WX Product Guide, under Downloads at the Badge WX product page [45].

Graph

BlocklyProp reference for GRAPH blocks

For Propeller Activity Board WX (via USB connection only), Hackable Electronic Badge, FLiP, and Other board types.

The GRAPH blocks are used to generate a visual graph of data in BlocklyProp's Graphing window.  This window will open automatically when you run a project that uses these blocks.

Do not try to use Graph and Terminal blocks in the same project.   The Terminal takes charge and will prevent the Graphing window from opening. You would, however, see some data values appear in the Terminal window.
Do not use the Graph blocks in a function that will be launched with the New Processor block.  It won't work - the Graph needs to be used from your project's main processor.

  • See the Graphing Data [46] page of the Simple BlocklyProp Programs tutorial for an example project that doesn't require any circuits.
  • Watch the YouTube video below to see the Propeller Activity Board WX receive and graph data from an analog sensor.


Graph initialize

Use the Graph initialize block at the beginning of your project to set the display area for the data that your project will graph. 

  • keep selects the minimum number of seconds of the latest data to display in the graph at a time. As the display fills, you may see the horizontal division values change if your project continues to send data for longer than the value you enter here.
  • y-axis selects a vertical scale option from the drop-down.
    • autoscale allows the y-axis to continuously adjust to best fit your data; you may see the vertical division values change as your graph plots.
    • range if selected will provide fields for entering minimum and maximum values.

Graph value

 

The Graph value block sends the attached value to the graph display.  Click the gear to display additional values from the same block; you will be able to label each value. Each value plotted is a different color, with a matching label and numerical data displayed in a box in the Graphing window's upper right corner.


 

OLED

BlocklyProp reference for OLED blocks

Available for Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin availability will vary with board type.

The 96 x 64 Color OLED display module (#28087) [47] uses a coordinate grid to define where text, numbers, points, lines, and shapes can be drawn on the display module’s screen. The coordinates start at 0 (leftmost column), 0 (top row) and increase to 95 (rightmost column), 63 (bottom row).

See the OLED Display with BlocklyProp tutoria [48]l to get started.

WARNING! The OLED blocks can only be used from your main program. These blocks will not work if used inside function blocks that are then launched with the new processor block.


OLED initialize

The OLED initialize block is used to set up the Color OLED display module. The DIN, CLK, CS, D/C, and RES pins on the module must be matched to the Propeller I/O pins they are connected to. 

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:

If you forget to use this block in your project, other OLED blocks will display a triangle warning symbol. Click the triangle, and you will see a reminder message to use the OLED initialize block at the beginning of your program.


OLED font loader

The OLED font loader block must be run as its own program (with no other blocks) before any medium or large fonts can be used. When this block is run, it takes about a minute to load all of the fonts onto the EEPROM memory chip on the Propeller Activity Board.

The fonts are stored in EEPROM locations 40576..63400.


OLED max height

The OLED max height block returns the vertical value of the bottom row of pixels: 63 when the pins are in a vertical orientation, 95 when the pins are in a horizontal orientation.


OLED max width

The OLED max width block returns the horizontal value of the rightmost column of pixels: 95 when the pins are in a vertical orientation, 63 when the pins are in a horizontal orientation.


OLED command

The OLED command block permits you to choose and execute the command selected from the drop-down menu:

  • clear screen: clears the entire screen by setting all pixels to black.
  • sleep: turns off the display, while preserving what was drawn on it.
  • wake: takes the display out of sleep mode.
  • invert: Inverts all of the colors on the display.
  • orient pins (up/down/left/right): changes the coordinate system to reflect a different orientaion of the OLED module for any draw commands after this block is used.  Does NOT rotate or change anything that has already been drawn to the screen.

OLED font color

The OLED font color block is used to set both the color of the font and the background (highlight) color displayed behind the font characters. If the background color is set to the same color as the font color, the background will be made transparent.


OLED set text

The OLED set text block is used to set the size (small: 5x7, medium: 11x15, large: 17x23) and the font face (sans/console, serif/typewriter, script/handwriting, bubble/cartoon).


OLED set cursor

The OLED set cursor block sets the top left pixel position where text starts being written.


OLED print text

The OLED print text block is used to send text strings to the OLED module.


OLED print number

The OLED print number block is used to send numbers to the OLED module. Numbers can be displayed as a decimal, hexadecimal, or binary.


OLED print multiple

The OLED print multiple block can print several terms of different types on a single line. Click the gear icon to drag additional terms into the list, then attach appropriate values to the block.  Options are:

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

Checking the Specify Digits block adds a fill-in field next to all attached number values. 

Floating point number option

BlocklyProp uses integer numbers. The floating point number option allows an integer value to be displayed as a decimal number.  Use its drop-down menu to divide the integer by a multiple of 10 to scale and display the number appropriately. The specify digits checkbox activates an additional field by each numeric term.


OLED draw pixel

The OLED draw pixel block sets the pixel defined by the first two value blocks to the color defined by the color block.


OLED draw line

The OLED draw line block draws a line from the first coordinate to the second coordinate in the color defined by the color block.


OLED draw triangle

The OLED draw triangle block draws a triangle from the first coordinate to the second coordinate to the third coordinate in the color defined by the color block. The “fill” checkbox sets whether the triangle will be drawn as hollow or filled.


OLED draw rectangle

The OLED draw rectangle block draws a rectangle from the first coordinate (top left corner of the rectangle) to the second coordinate (bottom right corner of the rectangle) in the color defined by the color block. The “roundness” value, if set to something other than zero, will round the corners by the amount specified (radius of the roundness). The “fill” checkbox sets whether the rectangle will be drawn as hollow or filled.


OLED draw circle

The OLED draw circle block will draw a circle whose center is set by the first two value blocks, and in the color defined by the color block. The “fill” checkbox sets whether the circle will be drawn as hollow or filled.

Protocols

BlocklyProp reference for PROTOCOLS blocks

For Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The PROTOCOLS blocks simplify communication between the Propeller microcontroller and other electronic devices that use a standardized method of communication.

I/O pin availability will vary with board type. Use care if accessing I/O pins connected to built-in accessory circuits on your board. Refer to your board's product guide for I/O pin assignment details.


Serial initialize

This block launches a processor automatically, one processor per block. 

The serial initialize block sets up a serial connection. If you forget to use this block, other serial blocks will remind you with a triangle-shaped warning icon:

You may set up more than one serial connection by using a separate Serial initialize block for each.  If you set up more than one serial initialize block in a project, a drop-down menu will appear on the serial transmit and serial receive blocks to select the target serial connection's Propeller I/O pin.

For each instance:

  • Set RX (Propeller I/O pin to receive data), and TX (Propeller I/O pin to transmit data) from the block's drop-down fields.
  • Set the baud rate from the drop-down.  If the baud rate you need is not listed, choose Other, and type over the number shown (the menu then disappears). 
  • Set the mode; the default is Standard. If you choose Other, the block will expand to include four more checkboxes for mode configuration as shown below.



Serial transmit

The serial transmit block sends the value in the inserted block, converted to a zero-terminated text string.  Pre-format the value into one of the following forms with the drop-down menu:

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • ASCII character

If using more than one serial initialize block, select the Propeller I/O pin for the target serial connection in the dropdown that will appear.

Note that the original blocks serial transmit text and serial transmit number have been deprecated. 


Serial receive

The serial receive block collects a string of characters until it receives a terminating zero.  The characters are then decoded into the type of value chosen in the drop-down menu, and that value is stored in the specified variable item.

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • ASCII character

If using more than one serial initialize block, select the Propeller I/O pin for the target serial connection in the dropdown that will appear.

Note that the original blocks serial receive text and serial receive number have been deprecated.


 Serial send multiple

The Serial send multiple block is used to send attached values or text to the device connected to the specified pin.


Serial receive multiple

The Serial receive multiple block is used to receive numbers or characters from the specified pin and store them in the specified variables.


Serial status

The Serial status block returns true (1), false (0), or a character depending on the status of the serial connection and the type of status required.


shift in

The shift in block receives a value sent to the Propeller serially.  The DATA and CLK pins must be matched to the pins that are connected to the device sending the serial information.  The shift in block will receive the number of bits specified by the first drop-down menu, in the order specified by the second drop-down menu (MSB: Most significant bit first or LSB: Least significant bit first), and manner specified by the third drop-down menu: read the DATA pin before the clock, or read the DATA pin after the clock.

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:


shift out

The shift out block sends a value serially.  The DATA and CLK pins must be matched to the pins that are connected to the device receiving the serial information.  The shift out block will send the number of bits specified by the first drop-down menu, in the order specified by the second drop-down menu (MSB: Most significant bit first or LSB: Least significant bit first).

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:


RGB LEDs

BlocklyProp reference for RGB LED blocks

For Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

BlocklyProp supports just one RGB-LED Init block per project, so if you want to use multiple RGB LEDs, chain them together instead of wiring them to separate Propeller I/O pins. These blocks are intended for WS2812B RGB LED modules (Parallax #28025 [49]& 28026 [50]).


RGB-LED init

This block launches a processor automatically, one per block instance.

The RGB-LED init block is used to specify the Propeller I/O pin connected to the RGB LED module(s), and to also specify the number of LEDs chained together. If you forget to use this block, other RGB-LED blocks will remind you with a triangle-shaped warning icon:

  • In the first drop-down field select the Propeller I/O pin connected to the signal input pin of the first RGB LED, in a chain of 1 or more LEDs.
  • In the second field, enter the number of RGB LEDs chained together.
  • In the third drop-down, specify the type of RGB LEDs being used (WS2812 is the only initial option).

If you use more than one RGB-LED init block in a project, the RGB-LED set and RBG-LED update blocks will provide a dropdown for selecting the targeted Propeller I/O pin for a given set of RGB-LEDs.


RGB-LED set

The RGB-LED set block allows you to choose a color for a specific RGB LED.

  • In the number field, Insert a number value specifying the location of the target RGB LED in the chain.  RGB LED number 1 is the unit directly connected to the Propeller I/O pin.
  • In the color field, insert a color value. Click its window and choose a color* from the pop-up menu.
  • If you are using more than one RGB-LED init block in a project, select the Propeller I/O pin for the target RGB LED(s) from the dropdown that will appear.

Use a new block to set the color for each RGB LED in the chain. The settings will not take effect until the program execution reaches an RGB-LED update block.

*Keep in mind that with WS2812B LEDs, brightness and current draw will vary by color, with white being the brightest and most power-consuming setting.


RGB-LED set multiple

The RGB-LED set block allows you to choose a color for a specific contiguous range of RGB LEDs chained together.

  • In the first number field, Insert a number value specifying the location of the first target RGB LED in the chain.  RGB LED number 1 is the unit directly connected to the Propeller I/O pin.
  • In the second number field, Insert a number value specifying the location of the last target RGB LED in the desired chain. 
  • In the color field, insert a color value. Or, click its window and choose a color* from the pop-up menu.
  • If you are using more than one RGB-LED init block in a project, select the Propeller I/O pin for the target RGB LED(s) from the dropdown that will appear.

Use a new block to set the color for each RGB LED in the chain. The settings will not take effect until the program execution reaches an RGB-LED update block.

*Keep in mind that with WS2812B LEDs, brightness and current draw will vary by color, with white being the brightest and most power-consuming setting.


RGB-LED update

The RGB-LED update block updates all of the RGB LED colors to the settings specified in the most recent RGB-LED set blocks. Each time the colors are changed with RGB-LED set blocks, the RGB-LED update block must be used again to see the new colors.

If you use more than one RGB-LED init block in a project, the RBG-LED update blocks will provide a dropdown for selecting the targeted Propeller I/O pin for a given set of RGB-LEDs.

Serial LCD

BlocklyProp reference for SERIAL LCD blocks

For Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin availability will vary with board type. Use care if accessing I/O pins connected to built-in accessory circuits on your board. Refer to your board's product guide for I/O pin assignment details.

The SERIAL LCD blocks are used to set up and send information to be displayed (or played) on Parallax 2x16 (#27976 [51] & #27977 [52]) and 4x20 (#27979 [53]) character LCD modules.


LCD initialize

This block launches a processor automatically. Use only instance of this block per project.

The LCD initialize block is used to set up a connection to a Parallax Serial LCD module. If you forget to use this block, other LCD blocks will remind you with a triangle-shaped warning icon:

  • PIN must be set to the Propeller I/O pin it is connected to. Options are 0-27; however, I/O pins 18-27 are connected to other circuits on the Propeller Activity Board and should not be used here.

    If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:

  • baud must match the switches set on the back of the Parallax LCD module:

The module can be plugged into the breadboard on the Propeller Activity Board or Propeller Activity Board WX, and the +5VDC, GND, and RX wires can be connected as shown:


LCD print text

The LCD print text block sends the inserted text string to the serial LCD module.


LCD print number

The LCD print number block sends the inserted number value to the serial LCD module. Use the dropdown menu to choose how to display the value, as a decimal, hexadecimal, or binary number.


LCD print multiple

The LCD print multiple block can print several terms of different types on a single line. Click the gear icon to drag additional terms into the list, then attach appropriate values to the block.  Options are:

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

Checking the Specify Digits block adds a fill-in field next to all attached number values. 

Floating point number option

BlocklyProp uses integer numbers. The floating point number option allows an integer value to be displayed as a decimal number.  Use its drop-down menu to divide the integer by a multiple of 10 to scale and display the number appropriately. The Specify Digits checkbox activates an additional field by each numeric term.


LCD command

The LCD command block is used to issue specific commands to the LCD module. Select an option from the dropdown menu:

  • clear screen - erases the screen
  • move cursor left - by one character
  • move cursor right - by one character
  • move cusror down - to the next line
  • carriage return - places cursor at first character in the next line
  • backlight on
  • backlight off
  • display off
  • display on, cursor off
  • display on, cursor off, blink
  • display on, cursor on
  • display on, cursor on, blink

LCD set cursor

The LCD set cursor block sets the position of the cursor on the LCD screen. It can be used to print text or numbers at any location on the screen.


LCD play note

The LCD play note block is used to make the Parallax LCD module play a musical note from its onboard piezo speaker.

  • Set the note pitch (or rest) from the first dropdown.
  • Set the octave, 3rd to 7th, in the second dropdown.
  • Set the note duration in the third dropdown, ranging from a whole note (2 seconds) down to a sixty-fourth (31 ms).

Terminal

BlocklyProp reference for TERMINAL blocks

Available for all board types via a USB connection. Not currently available over WiFi with the Activity Board WX or Badge WX.

The TERMINAL blocks are used for displaying text on your computer screen, using BlocklyProp's built-in Terminal. The Terminal will open automatically when you run a project that uses these blocks.

Do not try to use Terminal and Graph blocks in the same project. The Terminal takes charge and will prevent the Graphing window from opening. You may, however, see some data values appear in the Terminal window.
Do not use the Graph blocks in a function that will be launched with the New Processor block.  It won't work - the Graph needs to be used from your project's main processor.


Terminal print text

The Terminal print text block is used to send text to the Terminal window. When checked, the "then a new line” checkbox adds a carriage return to the end of the text that was sent, moving the cursor to the beginning of the next line in the Terminal.  (Note: earlier versions of this block omitted the quotation marks around the text string.)


Terminal print number

The Terminal print number block sends the inserted value to the Terminal window. Set the drop-down menu to display the number as a decimal, hexadecimal, or binary. The “then a new line” checkbox, when checked, adds a carriage return to the end of the number that was sent, moving the cursor to the beginning of the next line in the Terminal.


Terminal print multiple

The Terminal print multiple block can print several terms of different types on a single line.  When checked, the "then a new line” checkbox adds a carriage return to the end of the text that was sent, moving the cursor to the beginning of the next line in the Terminal. 

Click the gear icon to drag additional terms into the list. Checking the "specify digits" box adds an optional field to all numeric values. Then attach appropriate values to the block, and optionally specify how many digits to display for each numerical value.  Options are:

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

Floating point number option

BlocklyProp uses integer numbers. The floating point number option allows an integer value to be displayed as a decimal number.  Use its drop-down menu to divide the integer by a multiple of 10 to scale and display the number appropriately.


Terminal receive text

The Terminal receive text block stores any characters typed into the Terminal into the variable item chosen in the drop-down menu. The characters entered, even if they are numbers, are stored as a string. This block will continue to collect up to 128 characters until the user presses the enter key (sends a carriage return character). Program execution will pause until the carriage return character is received.


Terminal receive number

The Terminal receive number block stores numerical characters typed into the Terminal into the variable item chosen in the drop-down. The number entered is stored as an integer. This block will continue to collect numerical characters until the user presses the enter key (sends a carriage return character).  Program execution will pause until the carriage return character is received.


Terminal new line

The Terminal new line block sends a single carriage return character to the Terminal, moving the cursor to the beginning of the next line.


Terminal clear screen

The Terminal clear screen block sends a special character to the screen, which causes the Terminal to clear and reset the cursor to the top left (0,0) position.


Terminal set cursor

The Terminal set cursor block positions the cursor in the window.

  • First, use a Terminal clear screen block, which also places the cursor in the top-left 0, 0 positions.
  • Insert a number value to the desired row.
  • Insert a number value to the desired column, 0 to 255.

Terminal close

The Terminal close block closes the Simple Terminal object so that pins 30 and 31 can be used for other purposes such as a full-duplex serial connection.

WX WiFi

UNDER CONSTRUCTION! BlocklyProp reference for using Parallax WX ESP8266 WiFi Module communication blocks.

Compatible with the Activity Board WX, FLiP, Badge WX, and Other board types only.

This module comes in two form factors:

  • DIP [54]: Two rows of legs underneath plug into a socket on your Propeller Activity Board WX.
  • SIP [55]: One row of legs at the bottom plug into a breadboard.

Simple WX

UNDER CONSTRUCTION!!  These blocks are under development and not yet available on our production Blocklyprop tool. 

BlocklyProp block reference for Simple WX blocks. Use these with the Parallax ESP8266 WX WiFi Module

Compatible with the Activity Board WX, FLiP, Badge WX, and Other board types only.

Advanced WX

BlocklyProp block reference for Advanced WX blocks

Use these with Parallax products containing an ESP8266 WX WiFi Module.

Compatible with the Activity Board WX, FLiP, Badge WX, and Other board types. 

The Simple WX blocks and Advanced WX blocks are NOT compatible with each other! 
A program that contains Advanced WX blocks cannot contain any Simple WX blocks, and a program that contains Simple WX blocks cannot contain any Advanced WX blocks.


Advanced WX initialize

This block launches one processor automatically.

The Advanced WX initialize block is required when using other WX advanced blocks on any board or device except the Badge WX.

Use the mode drop-down menu to determine where the Terminal output should be routed through (this is for any blocks using Terminal or Graphing). Text sent between the computer and your board/device can be routed through the USB cable or, in future BlocklyProp versions, the WX module:

  • Terminal on USB - only option currently supported.
  • Terminal on WX - NOT currently supported; use when programming the board via USB and using the Terminal or graphing via the WX module.
  • Terminal & Programming on WX - NOT currently supported; use when programming and using the Terminal or graphing via the WX module.

Use the DI (Data In) menu to select to which pin the DI pin of the WX module is connected. If you select a pin other than the WX socket, then a second DO (Data Out) menu will appear for you to define that pin connection as well.


Advanced WX connect

The Advanced WX connect block instructs the WX module to listen for incoming HTTP, WebSocket, or TCP data.

The WX module can listen for data from up to four sources. Therefore, this block can be used up to four times.

When it establishes a connection, the program stores the ID for this connection in the variable specified by the store ID in menu.

For each type of connection, you must specify a path as a string of text for the module to connect. For example, to connect to a web service via HTTP, you could use "http://blockly.parallax.com/blockly/ping" or the URL for your specific web service.

HTTP and WebSocket connections default to port 80. For TCP connections, an additional input will appear. You must specify this port as a number.


Advanced WX poll

The Advanced WX poll block instructs the WX module to check the connections set up by the Advanced WX connection block for any incoming data. If any data is received, then a character code for the event type is stored in the variable specified by the first drop-down:

  • 'G' (GET request)
  • 'P' (POST request)
  • 'W' (WebSocket connection request)
  • 'D' (Data ready)
  • 'S' (Successful reply or Send operation)
  • 'X' (Disconnect occurred)
  • 'N' (Nothing to report)
  • 'E' (Error)

The ID of the connection corresponding to the event code will be stored in the variable specified by the second drop-down menu.

A handle that can be used to retrieve any data from this poll will be stored as a number in the variable specified by the third drop-down menu.


Advanced WX print

The Advanced WX print block can print several terms of different types to the WX module. 

First, specify whether the information will be sent:

  • as an HTTP GET request
  • as a TCP packet
  • via a WebSocket
  • as a Command to the WX module

Next, specify the connection handle, retrieved by the Advanced WX poll, where you want the string of text sent.

Click the gear icon to drag additional terms into the list. Options are:

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

This block works similarly to the Terminal print multiple shown in this video:

Floating point number option

BlocklyProp uses integer numbers. The floating point number option allows a program to display an integer value as a decimal number. Use its drop-down menu to divide the integer by a multiple of 10 to scale and display the number appropriately, as shown in the video below using the Terminal print multiple block.


Advanced WX send

The Advanced WX send block sends the attached string of text to a TCP connection specified by the handle provided.

The handle is one of the values retrieved by the Advanced WX poll block.


Advanced WX scan multiple

The Advanced WX scan multiple block scans the received string and stores the data extracted from the string as specified.

First, specify where the information has been retrieved from:

  • an HTTP POST request
  • a TCP packet
  • a WebSocket
  • the replay from a Command to the WX module

Next, specify the connection handle, retrieved by the Advanced WX poll, where the string of text should be sent.

Click the gear icon to drag additional terms into the list. Options are:

  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

For POST requests, the name in the name/value pair should be specified in the "string starts with txt" parameter.


Advanced WX scan string

The Advanced WX scan string stores an incoming string in the specified variable.

First, specify whether information has been retrieved from:

  • an HTTP POST request
  • a TCP packet
  • a WebSocket
  • the replay from a Command to the WX module

Next, specify the connection handle, retrieved by the Advanced WX poll, where the string of text should be sent.

Lastly, specify the variable in which to store the string. 

If you are retrieving data from a TCP connection, you must store the string in the variable set at the WX buffer by the Advanced WX buffer block.    

String variables only store up to 64 characters by default. Use the Advanced WX buffer block (for TCP connections), or the String variable set size in the OPERATORS > STRINGS menu if you need to store a longer string.


Advanced WX receive

The Advanced WX receive block receives and stores an HTTP response header or data from a TCP or WebSocket connection.

First, specify the string variable in which to store the received string. 

String variables only store up to 64 characters by default.  Use the String variable set size in the OPERATORS > STRINGS menu if you need to store a longer string.

Next, specify the variable where the length of the received string will be stored.

Then, specify an active connection handle, retrieved by the Advanced WX poll.  

Lastly, make sure that the maximum bytes retrieved is long enough for the incoming string.


Advanced WX mode

The Advanced WX mode block sets or gets the current mode of the WX module.

  • AP mode sets the WX module to be a WiFi access point.
  • STA mode sets the WX module to be a WiFi station on an existing network.
  • AP + STA mode sets the WX module to behave as both a station and as an access point.

Advanced WX code

The Advanced WX code block provides the value for one of the codes used by the WX module.


Advanced WX buffer

The Advanced WX buffer block is used to set a receiving buffer. If you are not receiving all of the characters from an incoming stream of data, then you may need to increase the size of this buffer. 

Use only as much buffer space as you need. There is a limited amount of memory available on the Propeller, and issues such as program lockup may occur when string buffers use more memory than is available.


Advanced WX join network

The Advanced WX join network block allows you to join a WiFi network by specifying its SSID and that network's passphrase.


Advanced WX disconnect

The Advanced WX disconnect block disconnects the WX module from the specified connection.


Advanced WX IP address

The Advanced WX IP address block provides the IP address of the specified mode as a string. Because the WX module can be both a station and an access point, it may have separate IP addresses for each.

XBee

BlocklyProp reference for XBEE blocks

For Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin availability will vary with board type.

These blocks work with XBee 802.15.4 (series 1) RF modules [56].  For any XBee model, you may also use the Serial Initialize, Serial transmit, and Serial receive [57] blocks for direct asynchronous serial communication.


XBee initialize

This block launches a processor automatically.

The XBee initialize block sets up a serial connection to an XBee module.

  • DO: Set the Propeller I/O pin connected to the XBee module's data out pin.*
  • DI: Set the Propeller I/O pin connected to the XBee module's data in pin.*
  • baud: set the baud rate at which to communicate with the XBee modules. Almost all XBee modules operate at 9600 baud, however, if your XBee module is configured to operate at a different baud rate, that can be set using this block as well.

* These drop-down options go from 0 to 27 but do not set higher than 17 with the Propeller Activity Board WX, as P18-P31 are already connected to other built-in circuits on this board. Use jumper wires to connect DO and DI sockets on the header in the middle of the board to I/O pin sockets alongside the breadboard.

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:


XBee transmit

The XBee transmit block sends a number (as an ASCII string in decimal format), a string, or a single byte depending on the option chosen using the drop-down menu.


XBee receive

The XBee receive block receives a number (as an ASCII string in decimal format), a string, or a single byte depending on the option chosen using the first drop-down menu and stores it in the variable selected in the second drop-down menu.


Xbee send multiple

The Xbee send multiple block is used to send attached values or text to the Xbee module.


Xbee receive multiple

The Xbee receive multiple block is used to receive numbers or characters from the Xbee module and store them in the specified variable.

Sensor

BlocklyProp reference for SENSOR blocks

Block and I/O pin availability will vary with board type for each sensor. Use care if accessing I/O pins connected to built-in accessory circuits on your board. Refer to your board's product guide for I/O pin assignment details.

2-Axis Joystick

BlocklyProp reference for 2-AXIS JOYSTICK blocks

Only for Propeller Activity Board WX board type.

These blocks are for Parallax's 2-Axis Joystick (#27800) [58] used only with the A/D converter built into the Propeller Activity Board (original or WX). 

New to this sensor? Click here to see an example schematic and quick Blockly program [59] to help you get started.


Joystick x-axis

BlocklyProp block for Joystick x--axis A/D I/O pin connection selection

The Joystick x-axis block returns the horizontal position of the joystick, which can range from 0 to 100. 

Connect the Joystick's L/R (x-axis) pin to a numbered A/D socket on the Propeller Activity Board WX, and then set the A/D drop-down to that socket's number (0-3).


Joystick y-axis

The Joystick y-axis block returns the vertical position of the joystick, which can range from 0 to 100.

Connect the Joystick's U/D (y-axis) pin to a numbered A/D socket on the Propeller Activity Board WX, and then set the A/D dropdown to that socket's number (0-3).

Joystick Wiring & Example Code

The Parallax 2-Axis Joystick can be used for a wide variety of projects like wheeled robots, video games, or anything requiring user input. The Propeller Activity Board's A/D converter reads the joystick's output on each axis.

Wiring & Connections

 

Quick Code Example

Using the connections shown in the wiring diagram above, this program will show you Joystick Up/Down and Left/Right position values (0-99) in the Terminal.

BlocklyProp code to run a simple Terminal program for the 2-Axis Joystick.

4 x 4 Keypad

BlocklyProp reference for KEYPAD blocks

For Propeller Activity Board WX, FLiP and Other board types. Not available for Badge or Scribbler Robot board types.

These blocks are specifically for the 4 x 4 Matrix Membrane Keypad (#27899) [60] sold by Parallax.

New to this sensor? Click here to see an example schematic and quick Blockly program [61] to help you get started.


4x4 Keypad Initialize

The 4x4 Keypad Initialize block defines the connections between the Keypad's ribbon cable and the Propeller microcontroller's I/O pins. I/O pin availability will vary by board type.

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:

If you forget to use this block in your program, a triangle warning icon will appear on other 4 x 4 keypad blocks as a reminder.

With the keypad facing you, start matching from the leftmost pin to the rightmost pin. The four rightmost pins MUST be connected to pull-down resistors; use 1 k-ohm to 100 k-ohm resistors for this.


4x4 Keypad Read

The 4x4 Keypad read block provides a number value for the key pressed. 

  • 0-9 read as values 0 to 9
  • A reads as 65 (ASCII character 'A')
  • B reads as 66 (ASCII character 'B')
  • C reads as 67 (ASCII character 'C')
  • D reads as 68 (ASCII character 'D')
  • # (pound sign) reads as 35 (ASCII character '#')
  • * (asterisk) reads as 42 (ASCII character '*')
  • No button pressed reads as -1.

4x4 Keypad Wiring & Example Code

This example is specifically for the 4 x 4 Matrix Membrane Keypad (#27899) [60] sold by Parallax.

 

Wiring & Connections

Activity Board WX wiring for the 4x4 Matrix Keypad.

Propeller FLiP wiring diagram for the 4x4 Matrix Keypad.

 

Quick Code Example

Using the connections shown in the wiring diagram above, this program will show you the number of the key you are pressing on the keypad, in the Terminal, updating once per half-second.

Quick code example for the 4x4 Keypad with BlocklyProp.

The numbers you see should be very stable. If they fluctuate quickly, or if you notice numbers showing up that you did not press, double-check that you have 1 kOhm (or higher) resistors from pins P7-P4 going to ground and that they're firmly in the correct breadboard row and ground holes. See connection image, above.

Badge Accelerometer

BlocklyProp Block Reference for BADGE ACCELEROMETER blocks

Compatible only with Badge board types.


Badge accelerometer get

The Badge accelerometer get block returns acceleration and tilt on one of 3 axes (AX, Ay, or AZ) in centigravity units (cg) which is 100ths of 1 gravity (1 g).


Badge accelerometer shaken

The Badge accelerometer shaken block checks to see if the accelerometer was shaken within the last half second.

Badge Buttons

BlocklyProp block reference for BADGE BUTTON blocks

Block availability varies by Badge type.


Badge button touchpad

Compatible only with the Hackable Electronic Badge board type

The Badge button touchpad block returns the state of the specified rocker or touchpad button - (1) pressed, (0) not pressed.


Badge button

Compatible only with the Badge WX board type

The Badge button block returns the state of the specified rocker or touchpad button - (1) pressed, (0) not pressed.


Badge touch sensitivity

Compatible only with the Badge WX board type

The Badge touch sensitivity block sets the sensitivity of the touchpads (A & B) on the badge.

ColorPal

BlocklyProp reference for COLORPAL blocks

Available for Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin range options will vary with board type.

These blocks use a ColorPal Color Sensor (#28380) [62] 

New to this sensor? Click here to see an example schematic and quick Blockly program [63] to help you get started.


ColorPal initialize

This block launches a processor automatically, one per block instance.

The ColorPal initialize block sets up the ColorPal sensor. If you forget to use this block, other LCD blocks will remind you with a triangle-shaped warning icon:

From the PIN dropdown, select the Propeller I/O pin number that is connected to the ColorPal module's signal pin.

If you use more than one ColorPal initialize block in a project, the other ColorPal blocks will provide a drop-down to select the Propeller I/O pin for your target ColorPal module.


ColorPal raw colors

The ColorPal raw colors block measures the amount of red, green, and blue it detects. Each of those three raw values is stored in the corresponding variable selected in each drop-down menu. The raw values can range from 0 to 4095. The raw values are not white-balanced, but when used correctly, they can be more accurate than the value provided by the ColorPal get color block.

  • Choose the target variables in which to store the ColorPal output values for the R (red), G (green), and B (blue) components of the sampled color.
  • If you are using more than one ColorPal initialize block in a project, select the Propeller I/O pin for the target ColorPal module from the drop-down that will appear.

ColorPal get color

The ColorPal get color block takes a measurement and provides a single, approximate white-balanced,  24-bit color value that is stored in the variable selected in the drop-down.  That variable can then be used with other color value blocks [64].

  • Choose the target variable in which to store the sampled ColorPal output value.
  • If you are using more than one ColorPal initialize block in a project, select the Propeller I/O pin for the target ColorPal module from the drop-down that will appear.

ColorPal Wiring & Code Example

For sensing color, the ColorPAL uses its LED to illuminate a sample, one color component at a time, along with a broad-spectrum light-to-voltage converter to measure the light reflected back. The amount of light reflected from the sample under illumination from each red, green, and blue LED can be used to determine the sample’s color.

 

Wiring & Connections

If using a Propeller Activity Board, the ColorPal can be connected to either the breadboard or via a 3-wire extension cable to one of the servo headers P12-P17.

 

Quick Code Example

Using the connections shown in the wiring diagram above, this example will display the RGB values detected by the ColorPal in the Terminal. Try holding differently-colored objects up to the sensor to see their RGB values.

Quick-start BlocklyProp code for the ColorPal.

Fingerprint Scanner

BocklyProp reference for FINGERPRINT SCANNER blocks

These blocks are for use with the Fingerprint Scanner (#29126) [65] and the Propeller Activity Board WX, Propeller FLiP or Other board types. Not available for Badge or Scribbler Robot board types.

New to this sensor? Click here to see an example schematic and quick Blockly program [66] to help you get started.


Fingerprint scanner initialize

This block launches a processor automatically. Use only one instance of this block per project.

Use the Fingerprint scanner initialize block to specify which Propeller I/O pins are connected to your device. I/O pins available for this use will vary with board type. 

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:

If you forget to use this block in your project, a triangle warning icon will appear on other Fingerprint scanner blocks as a reminder.


Fingerprint scanner capture

The Fingerprint scanner capture block lets you manage the fingerprint scans that are stored on the device. The action options from the drop-down menu are:

  • capture and save to - capture a fingerprint and save it to your device memory, assigning it the ID number of the inserted number value.
  • delete capture for - delete the captured fingerprint for the specified ID number from device memory.
  • delete all captures- delete all the captured fingerprints/ID numbers stored in the device memory.

Fingerprint scanner scan

The Fingerprint scanner scan block can perform three different actions and provides a value based on the outcome of the action. (However, none of these actions capture and save a new scan onto the device.)

  • scan and identify - scans the finger currently on the glass and searches for a match with the captures stored on the device. If a match is found it provides the capture's ID, if no match is found it provides a zero.
  • scan and compare - scans the finger currently on the glass and compares it to the stored capture specified by the inserted ID value. If they match, the block provides a 1; if they don't match the block provides a zero.
  • count number of IDs - provides the number of captures stored on your scanner.

Fingerprint Scanner Wiring & Example Code

The Fingerprint Scanner can scan and store up to 1000 fingertip image captures.  Your BlocklyProp project can compare a new scan to a specific capture by ID, or search all its captures for a match.

 

Wiring & Connections

 

Quick Code Example

Using the connections shown in the wiring image above, this example uses the Terminal to prompt a user to scan and assign an ID to their fingerprint, and then check that their fingerprint matches the assigned ID.

Quick-start BlocklyProp code for the Fingerprint Scanner.

GPS

BlocklyProp reference for GPS blocks

For Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

These blocks are compatible with GPS modules delivering an NMEA 0183 serial data stream. This includes the PAM-7Q (Parallax #28509).

New to this sensor? Click here to see an example schematic and quick Blockly program [67] to help you get started.


GPS initialize

This block launches a processor automatically. Use only one instance of this block per project.

The GPS Init block configures the communication from your GPS module to your Propeller microcontroller.

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:

If you forget to use the GPS init block first, other GPS blocks will show a triangle warning icon as a reminder:

  • TX: choose the Propeller I/O pin connected to the GPS module's TX or data out pin.
  • baud: choose the default baud rate of your GPS module, for the communication from the GPS module to the Propeller microcontroller. Options are 9600, 2400, 4800, and 19,200,

* I/O pin numbers available in this dropdown will depend on your selected board type.


GPS has satellite fix

The GPS has satellite fix block lets you know if your GPS module is receiving a usable satellite signal. The block provides 1 if true, 0 if false.


GPS latitude

The GPS latitude block provides the latitude in microdegrees (millionths of degrees).  Latitudes north of the Earth's equator are positive values, and latitudes south of the Earth's equator are negative values.


GPS longitude

The GPS longitude block provides the longitude in microdegrees (millionths of degrees).  Longitudes east of the Prime Meridian to are positive values, and longitudes west of the Prime Meridian are negative values.


GPS heading

The GPS heading block provides heading—the direction of travel—in degrees clockwise from magnetic north. The GPS module must be moving faster than two miles per hour to provide a meaningful heading value.


GPS altitude

The GPS altitude block provides altitude above sea level in centimeters.


GPS speed

The GPS speed block provides the speed that the GPS module is traveling, in the chosen unit of measurement. Choose mph (miles per hour) or knots (nautical miles per hour) from the drop-down menu. The GPS module must be moving faster than two miles per hour to provide a meaningful speed value.


GPS number of satellites

The GPS satellites tracked block provides the number of satellites that the GPS module can see.

GPS Wiring & Example Code

These blocks are compatible with GPS modules delivering an NMEA 0183 serial data stream. This includes the PAM-7Q (Parallax #28509).

Wiring & Connections

Schematic for the Waveshare NEO-7M-C GPS module and Propeller microcontroller for the example functions below. Wiring may be different for the PAM-7Q or other GPS modules, please see their product guides for specifics.

FLiP Wiring Alert! If using the Propeller FLiP module with a GPS module, use a 3-pin extension cable to provide some distance between the two modules to improve satellite reception and reduce interference.

Quick Code Example

The GPS Data Output Blockly example retrieves longitude, latitude, speed, heading, elevation, and number of satellites from the GPS module. The units are converted to decimal degrees and displayed in the Blockly terminal. The underlying GPS library is compatible with NEMA-formatted GPS strings. 

This example features a large number of blocks. We recommend that you download the SVG file containing this pre-arranged program below and append it to your own project,  rather than recreate it block-by-block. Want to learn more about downloading/uploading block files into BlocklyProp programs? Read the More BlocklyProp Features [68] section of the Getting Started with Blockly tutorial series. The basics are covered briefly below to get you started.

  • Waveshare NEO-7M GPS Data Example Blocks [69]

Follow these instructions to add these blocks to your workspace:

  1. Open BlocklyProp [39] and log in.
  2. Unzip the file you just downloaded and make a note of the file location.
  3. Start a new BlocklyProp project, or open an existing project you want to add these blocks to.
  4. Save your project, then click on the button with 3 parallel lines on it (furthest top-right on the page).
  5. Choose "Upload Blocks File".
  6. Select the file you just unzipped, and click "Replace" to replace your current program with these blocks, or "Append" if you want to add the blocks to your project without deleting any already-existing blocks.

Your workspace should now contain the following program (note that these blocks are displayed in a different layout in this image):

HMC5883L

BlocklyProp reference for HMC5883L blocks

These blocks may be used with the HMC5883L compass module (#29133, discontinued) [70] blocks and the Propeller Activity Board WX, Propeller FLiP module, and Other board types. Not available for Badge or Scribbler Robot board types.


Compass initialize

The Compass initialize block sets up the communication between the Propeller chip and the compass module.

Set each drop-down to match the Propeller I/O pins connected to the HMC5883L compass module's SCL and SDA pins. (The drop-down options go to 27, but do not set higher than 17 with the Propeller Activity Board WX, as P18-P31 are already connected to other built-in circuits on this board.)


Compass heading

The Compass heading block stores the current unadjusted heading measured by the HMC5883L, in degrees as an integer, ranging from 0 to 359.

LSM9DS1 9-axis IMU

BlocklyProp reference for LSM9DS1 9-AXIS IMU blocks

Available for Activity Board, FLiP and Other board types. Not available for Badge or Scribbler Robot board types.

The LSM9DS1 9-axis IMU (#28065) [71] measures acceleration, rotation, and magnetic field strength along three perpendicular axes, shown and labeled in the image below:

 


IMU initialize

The IMU initialize block sets up the communication between the Propeller chip and the compass module.

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:

If you forget to use this block, a triangle warning icon will appear on other IMU blocks as a reminder:

Set each drop-down to match the Propeller I/O pins connected to the IMU's SCL, SDIO, CS_AG, and CS_M pins.  It is not necessary to connect the INT_A/G or INT_M pins. However, they may be read using a check PIN block if they are connected.  I/O pins available will vary by board type.

 


IMU calibrate magnetometer

The IMU calibrate magnetometer block is used to calibrate the magnetometer on the IMU module.

Use this block immediately after the IMU initialize block.  Hold the IMU (or your project that includes the IMU) flat but in a space with enough room to rotate it around.  Once the calibration has started, if you are using the ActivityBoard or FLiP, the P26 and P27 LEDs will turn on.  

Once the calibration has started, it will collect samples for 30 seconds.

If you only plan to use the IMU as a compass (for heading using 2 of the axes), you will want to set your device flat and rotate it slowly around during the 30-second sample collection.  If you need all 3 axes calibrated, you will need to slowly rotate your project around each of the IMU's 3 axes during the 30 seconds sample collection. 

You do not need to repeat the calibration again unless your environment (such as moving your project into or out of a building) or your location changes.


IMU read

The IMU read block stores the current accelerometer, gyroscope, or magnetometer measurements from each of the 3 axes into the specified variables.  The Accelerometer measurements are in g-100ths.  This means that a measurement of 1 g (1 Earth gravity) of acceleration will read as +100 in one direction or -100 in the opposite direction.  Gyroscope measurements are in hundredths of degrees of rotation per second (DPS-100ths).  Magnetometer measurements are in gauss-100ths.


IMU tilt

The IMU tilt block stores the current tilt angles measured by the IMU's accelerometer, measured in degrees as an integer, ranging from -180 to 180.   You must specify the axis that is pointing up/down (vertically) to ensure that your measurements are correct.  The tilt of the remaining to axes are then stored in the variables specified by their respective drop-down menus.


IMU heading

The IMU heading block stores the current unadjusted heading measured by the IMU's magnetometer, in degrees as an integer, ranging from 0 to 359.  You must specify which axes are pointed in which directions relative to the observer for the code to correctly resolve the compass heading.

Calibrate your IMU's magnetometer before using the IMU heading block.  You may also need to re-calibrate it if your environment or location changes from the last time it was calibrated.

MMA7455

BlocklyProp reference for MMA7455 blocks

Compatible with the Propeller Activity Board WX, Propeller FLiP, or Other board types. Not available for Badge or Scribbler Robot board types.

These blocks are for using the MMA7455 3-axis accelerometer module (#28526, discontinued) [72].

An acceleration meter (accelerometer) senses the forces that acceleration and gravity exert on a small mass inside the sensor. Think about that feeling of being pressed into your seat back as your car speeds up rapidly. Now think about the feeling of how gravity pulls you to the ground. Those are examples of the forces that an accelerometer senses and reports. The MMA7455 is a 3-axis accelerometer module that can measure up to +/- 8g of acceleration in 3 axes up to 250 times per second.


Accelerometer initialize

The Accelerometer initialize block is used to set up the MMA7455 accelerometer module. Match each dropdown menu to the PRopeller I/O pin connected to the CS, DATA, and CLK pins on the accelerometer module. 

 (The drop-down options go from 0 to 27, but do not set higher than 17 with the Propeller Activity Board WX, as P18-P31 are already connected to other built-in circuits on this board.)  


Accelerometer store values

The Accelerometer store values block stores the sensor's x-axis, y-axis, and z-axis measurements in the chosen variable items. 

Memsic 2-axis

BlocklyProp reference for MEMSIC 2-AXIS blocks

 Propeller Activity Board WX, Propeller FLiP module, or Other board types. Propeller I/O pin availability will vary by board type. Not available for Badge or Scribbler Robot board types.

These blocks are for using the MEMSIC2125 Dual-Axis Accelerometer (#28017) [73].

New to this sensor? Click here to see an example schematic and quick Blockly program [74] to help you get started.

The PIN menu on all of the Memsic 2-Axis blocks can be set to "other."  When "other" is chosen, the dropdown menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:


Memsic x acceleration

The Memsic x acceleration block returns the approximate acceleration measured by the Memsic sensor. Acceleration is measured in terms of g (acceleration due to earth's gravity): a value of +/-1250 corresponds to approximately +/- 1 g.

Set the PIN dropdown to the Propeller I/O pin connected to the sensor’s Xout pin.


Memsic y acceleration

The Memsic y acceleration block returns the approximate acceleration measured by the Memsic sensor.  Acceleration is measured in terms of g (acceleration due to earth's gravity): a value of +/-1250 corresponds to approximately +/- 1 g.

Set the PIN dropdown to the Propeller I/O pin connected to the sensor’s Yout pin.


Memsic rotation

The Memsic rotation block measures how much the sensor is rotated if it is held vertically (zero degrees is when the triangle on the Memsic sensor is pointed straight up. The sensor returns a measurement in degrees where 0 degrees is straight up, and 180 degrees is straight down.

Set the PIN dropdowns to the Propeller I/O pin connected to the sensor’s Xout and Yout pins.


Memsic x tilt

The Memsic x tilt block returns a measurement of how much the sensor has tilted in the x (sideways) direction when the top of the sensor is level with the ground.  The value returned is +/- 90 degrees.

Set the PIN dropdown to the Propeller I/O pin connected to the sensor’s Xout pin. 


Memsic y tilt

The Memsic y tilt block returns a measurement of how much the sensor has tilted in the x (front to back) direction when the top of the sensor is level with the ground. The value returned is +/- 90 degrees.

Set the PIN dropdown to the Propeller I/O pin connected to the sensor’s Yout pin.

Memsic 2125 Wiring & Example Code

The Memsic MX2125 Dual-axis Accelerometer is great for measuring tilt, vibration, rotation, and let’s not forget its namesake, acceleration. A few MX2125 project ideas might include a tilt video game controller, tilt robot controller, robot hill climbing sensor, and radio-controlled vehicle acceleration, speed, and position data logger.

 

Wiring & Connections

 

Quick Code Example

Using the connections shown in the wiring diagram above, this example will display X and Y tilt in the Terminal.

Quick-start BlocklyProp code for the Memsic 2125 Accelerometer.

PIR

BlocklyProp reference for PIR block

Compatible with the Propeller Activity Board WX, Propeller FLiP module, or Other board types. Propeller I/O pin availability will vary by board type. Not available for Badge or Scribbler Robot board types.

This block works with any of the Parallax PIR (passive infrared) motion sensors:

  • PIR Sensor Rev B (#555-28087) [75]
  • PIR Mini Sensor (#28083) [76]
  • Wide Angle PIR Sensor (#28032) [77]

New to PIR sensors? Click here to see an example schematic and quick Blockly program [78] to help you get started.


PIR sensor

The PIR sensor block returns a 0 (zero) if no motion is detected, and a 1 (one) if a motion is detected. The PIN dropdown must be set to the pin connected to PIR sensor’s out pin.

PIR Wiring & Example Code

A PIR Sensor can tell when something nearby moves. PIR stands for "Passive InfraRed". The sensor detects the pattern of infrared energy in its surroundings. If the pattern changes, the sensor outputs a high signal. The Propeller microcontroller only needs to monitor this signal with an I/O pin to know if something is moving around nearby.

 

Wiring & Connections

 

Quick Code Example

Using the connections shown in the wiring diagram above, this example will display the status of the PIR Sensor in the Terminal. A value of "1" indicates the sensor has been triggered (or set high), and a "0" is the resting (or low) state.

It is typical for the sensor to be triggered when it is first powered up and getting an infrared reading from its environment. This may last up to 30 seconds.Quick-start BlocklyProp code for the PIR sensor.

Ping))) Distance

BlocklyProp reference PING))) Distance block

Compatible with Propeller Activity Board WX, Propeller FLiP module, and Other board types. Not available for Badge or Scribbler Robot board types.  Use this block with the following distance sensors from Parallax:

  • PING))) Ultrasonic Distance Sensor (#28015) [79]
  • LaserPING 2m Rangefinder (#28041) [80]

New to these sensors? Click here to see an example schematic and quick Blockly program [81] to help you get started.


Ping))) distance

The Ping))) distance block returns the distance to an object detected by the sensor, between 1 inch (3 cm) and 124 inches (315 cm) away.

  • distance in drop-down: select whether you want the returned value to be in inches or centimeters
  • PIN dropdown:  select the Propeller I/O pin connected to the sensor. Options will vary by board type.

The PIN menu on this block can be set to "other."  When "other" is chosen, the drop-down menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:

PING))) Wiring & Example Code

The Ping))) Ultrasonic Distance Sensor measures the roundtrip echo time of ultrasonic sound to determine how far away an object is. It can measure distances anywhere from 3 centimeters to 3 meters. In addition to being a great distance sensor for robots, it’s also useful for detecting people passing through doorways, viewing art exhibits, approaching holiday props, and more.

Wiring & Connections

Parallax PING))) Ultrasonic Distance Sensor (left) and Parallax Laser PING (right)

     A schematic for connecting the Parallax PING))) Ultrasonic Distance Sensor to a Propeller board.

A wiring diagram for connecting the Parallax Laser Ping to your breadboard.  A schematic showing how to connect the Parallax Laser PING to your board.

Use a 2 k-ohm resistor (red-black-red) between the PING))) sensor's SIG pin and the Propeller I/O pin. 

 

Quick Code Example

Using the connections shown in the wiring diagram above, this example will display PING))) distance measurements in the Terminal Window.

Quick-start BlocklyProp code for the PING))) Ultrasonic Distance Sensor.

RFID

BlocklyProp block reference for RFID blocks

Use this block with the serial RFID Reader (#28140) [82] and the Propeller Activity Board WX, Propeller FLiP module, and Other board types. Not available for Badge or Scribbler Robot board types.

New to this sensor? Click here to see an example schematic and quick Blockly program [83] to help you get started.


RFID initialize

This block launches a processor automatically. Use one instance of this block per project.

The RFID initialize block is used to set up the Parallax RFID module. The EN and SOUT pins on the module must be matched to the Propeller Activity Board pins they are connected to.

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:


RFID read

The RFID read block reads the ID number from an RFID tag near the sensor. If no tag is detected, it provides a value of 0 (zero).


RFID disable/enable

The RFID disable/enable block depending on the option chosen in the dropdown menu, disables or enables the RFID sensor.


RFID close

The RFID close block closes the RFID object and frees up the resources the object was using inside of the Propeller microcontroller.

RFID Wiring & Example Code

RFID stands for Radio Frequency Identification. The Parallax RFID Reader Serial + Tag Sampler (#32390) [84] includes several unique RFID tags.

 

Wiring & Connections

Quick Code Example

Using the connections shown in the wiring diagram above, this example will display the unique identification number(s) of your RFID tag(s) in the Terminal. Please note this code is for the Serial RFID Reader, not the USB version.

Quick-start BlocklyProp code for the serial RFID sensor.

Sony Remote

BlocklyProp reference for SONY REMOTE block

Compatible with all Propeller board types

Use this block with a Sony protocol Infrared Remote (#020-00001) [85] and infrared receiver (#350-00039)

New to this sensor? Click here to see an example schematic and quick Blockly program [86] to help you get started.


Sony Remote value

The Sony Remote value block returns a value detected by the IR receiver that indicated which button on the remote was pressed.  If no button press was detected, this block provides a value of -1.

The PIN menu this block can be set to "other." When "other" is chosen, the drop-down menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:

IR Remote Wiring & Example Code

An IR receiver can detect bursts of infrared light sent by a common remote controller (like for a television), and then output a pattern of high/low signals to a Propeller I/O pin.

 

Wiring Diagram & Connections

Configure your remote for the Sony protocol, following its manufacturer instructions. (If you purchased the Brightstar brand remote from Parallax, hold the Setup button until the light near it comes on. Enter 6-0-5 and the light should go off. Done!)

 

Quick Example Code

Using the connections shown in the wiring diagram above, this example displays the number of the button pressed on your remote in the Terminal. When no button is pressed, the Sony Remote value block sends a -1, and the message Button press = none will appear in the Terminal.

Quick-start BlocklyProp code for the IR Remote.

Sound Impact Sensor

BlocklyProp reference for SOUND IMPACT SENSOR blocks

These blocks are for Parallax's Sound Impact Sensor (#29132) [87] and the Propeller Activity Board WX, FLiP, or Other board types. Not available for Badge or Scribbler Robot board types.

New to this sensor? Click here to see an example schematic and quick Blockly program [88] to help you get started


Sound Impact initialize

This block launches a processor automatically. Use only one instance of this block per project.

The Sound Impact initialize block sets up the Sound Impact Sensor.

If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:

If you forget this block, the other Sound Impact Sensor blocks will display a triangle warning icon as a reminder:

  • In the PIN dropdown, select the Propeller I/O pin connected to the Sound Impact Sensor's signal pin.

Sound Impact get count

The Sound Impact get count block returns how many sound impacts (loud sounds) were detected since the last time this block was used.  If no sound impacts were detected, it provides a value of zero.


Sound Impact close

The Sound Impact close block makes the Propeller microcontroller stop listening to the Sound Impact Sensor and frees up the resources it was using inside of the Propeller.

Sound Impact Wiring & Example Code

The Sound Impact Sensor detects sound from up to 3 meters away, lending noise-activation possibilities to your microcontroller projects

 

Wiring & Connections

Use a 2.2 k-ohm resistor (red-red-red) between the Sound Impact Sensor's SIG pin and the Propeller I/O pin. 

 

Quick Code Example

Using the connections shown in the wiring diagram above, this example will display "Sound detected!" if the sensor detects one or more sound events, and "No sound detected." otherwise.

Quick-start BlocklyProp code for the Sound Impact Sensor.

Temp & Humidity

BlocklyProp reference for TEMP & HUMIDITY blocks

Available for Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin range options will vary with board type.

These blocks are for the CM2302 Temperature & Humidity Sensor (#28059 [89]). It is also compatible with most DHT22 and AM2302 models.

See the next page for a Getting Started tutorial, and/or watch the Tiny Tutorial video below.


Temp & Humidity read

The Temp & Humidity read block triggers a supported sensor connected to the specified I/O pin to take and store temperature and relative humidity readings.  Readings can be updated every 30 seconds.

The PIN menu this block can be set to "other."  When "other" is chosen, the dropdown menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:


Temp & Humidity value

The Temp & Humidity value block provides the specified measurement from the data stored by the last Temp & Humidity read block.  Choose the type of data from the drop-down menu. Options are:

  • temperature (°F) - temperature in degrees Fahrenheit, x 10
  • temperature (°C) - temperature in degrees Celsius, x 10
  • temperature (Kelvin) - temperature in Kelvin, x 10
  • relative humidity (%) - relative humidity, x 10

BlocklyProp uses integer math: The value returned by this block is 10 times the temperature or relative humidity measured by the sensor.  To display the reading, use a print multiple block's floating point option for the Terminal, LCD, or OLED, and choose to divide the value by 10 on that block. See the wiring diagram and example code on the next page.

Temperature & Humidity Sensor Wiring & Example Code

The CM2302 Temperature and Humidity Sensor can take a reading of temperature and relative humidity for use by a microcontroller such as the Propeller.

Schematic and Wiring

       Schematic for wiring the 28059 Temperature and Humidity Sensor.    

Quick Code Example

The example code below displays the temperature and relative humidity in the BlocklyProp Terminal.  BlocklyProp uses integer math; the Temp & Humidity value block provides a value that is 10 times larger than the sensor reading. 

To display the sensor readings as floating-point values, use the Terminal print multiple block.  Click its gear icon, drag in text and floating point number blocks, and then click specify digits box:

Here is the complete code listing:

Save and run the project to display the data in the BlocklyProp Terminal:

Memory

BlocklyProp reference for MEMORY blocks

Block availability varies by board type. microSD card slots are included on the Activity Board WX and Badge WX boards. A pad for a microSD card holder is included on the Project Board USB.


EEPROM read

For Propeller Activity Board WX, Propeller FLiP,  Scribbler, and or Other board types.  Not available for Badge or board types.

The EEPROM read block reads data from the EEPROM memory on the Propeller Activity Board and saves it in a variable.

  1. Specify the kind of data to read—number, byte, or string— with the first dropdown.
  2. Insert a value block to provide the starting memory address, in the range of 0 to 7675.
  3. Choose a variable item to store the data retrieved.

Choose memory addresses carefully. Numbers take up 4 bytes of memory, a byte takes 1 byte of memory, and a string takes up 1 byte for each letter in the string plus 1 byte to indicate the end of the string (“Hello” would take 6 bytes of memory). The range used for address access by this block (0 to 7675) maps to the actual address range 32768 to 40443 in the Propeller Activity Board's upper EEPROM.


EEPROM write

For Propeller Activity Board WX, Propeller FLiP,  Scribbler, and or Other board types.  Not available for Badge or board types.

The EEPROM write block writes data to the EEPROM memory on the Propeller Activity Board.

  1. Specify the kind of data—number, byte, or string— with the first dropdown.
  2. Insert a value or variable block containing the data to write to EEPROM. Be careful to match the kind of data with the inserted value, to avoid unexpected results:
    • with number, use any variable, value, number, or operator block that resolves to a number.
    • with byte, use any variable, value, number, or operator block that resolves to a number in the range 0-255. A single character will be stored as its ASCII equivalent.
    • with string, use any variable or value block containing a string.
  3. Provide the starting memory address with a value block, in the range of 0 to 7675.

Choose memory addresses carefully. Numbers take up 4 bytes of memory, a byte takes 1 byte of memory, and a string takes up 1 byte for each letter in the string plus 1 byte to indicate the end of the string (“Hello” would take 6 bytes of memory). The range used for address access by this block (0 to 7675) maps to the actual address range 32768 to 40443 in the Propeller Activity Board's upper EEPROM.


Memory store contact

Compatible only with Badge board types.

The Memory store contact block stores up to 128 characters of text to EEPROM memory.


Memory check contact

Compatible only with Badge board types.

The Memory check contact block checks to see if a string of text has already been stored in EEPROM memory.


Memory get contact

Compatible only with Badge board types.

The Memory get contact block retrieves text with a certain index number from EEPROM memory.


Memory count contacts

Compatible only with Badge board types.

The Memory count contacts block returns how many contacts are currently stored in EEPROM memory.


Memory erase contacts

Compatible only with Badge board types.

The Memory erase contacts block erases entire user portion of EEPROM memory by placing 255 in each location.


SD file open SD card

Available for the Activity Board WX, FLiP or Project Board USB, Badge WX, and Other board types

The SD file open block opens the specified file on the SD card. Filenames can be up to 8 characters long, and a 3 character extension such as .TXT is required.


SD file read/write

Available for the Activity Board WX, FLiP or Project Board USB, Badge WX, and Other board types

The SD file read/write block is used to read from, write to, or close the current file on the SD card.


SD file pointer

Available for the Activity Board WX, FLiP or Project Board USB, Badge WX, and Other board types

The SD file set block sets or retrieves the current file pointer (location in characters where reads or writes begin from).


 

Analog / Pulses

BlocklyProp blocks for analog and pulse I/O. Block availability will vary by board type.

RC time

BlocklyProp reference for RC TIME block

For Propeller Activity Board WX, FLiP and Other board types. Not available for Badge or Scribbler Robot board types.


RC time

The RC time (formerly RC charge/discharge) block sets the specified Propeller I/O pin to an input and reports how long it takes for an RC (resistor/capacitor) circuit to either charge or discharge across the pin's logic threshold. The value provided by the block is in microsecond units.  This block must be used in conjunction with other blocks to charge (or discharge) the circuit before taking the measurement.

  • Choose the Propeller I/O pin connected to the target circuit in the RC dropdown. I/O pin options will vary by board type.
  • Choose which process time to measure (charge or discharge) from the RC dropdown. Or, click Other and insert a block that resolves to an I/O pin value.

The PIN menu this block can be set to "other."  When "other" is chosen, the dropdown menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:

The RC time block is useful for circuits with a variable resistor or other means to affect current flow, including potentiometers, phototransistors, thermistors, and some pressure sensors. See Read a Potentiometer with RC Time [90] for an example of this block in action.

Voltage

BlocklyProp reference for VOLTAGE blocks

Block availability varies by board type.


A/D read

Propeller Activity Board WX board type only

The A/D read block is designed for the A/D and D/A circuits built directly into the Propeller Activity Board (original and WX)

This block reads and reports the voltage input on the A/D channel chosen in the drop-down menu. The value provided by the block is in volt-hundredths: if +2.50 volts is applied to the A/D channel, the block will provide a value of 250.  It can be attached to a variable set block or used wherever a number value block is accepted.


D/A output

Propeller Activity Board WX board type only

This block launches a processor automatically. Using a second block for an additional D/A channel will not launch an additional processor.

The D/A output block sets the output voltage on the D/A channel chosen in the drop-down menu. The block expects a value in volt-hundredths: if value block placed in this block is 250, the D/A will output +2.50 volts.


A/D chip read

Propeller FLiP or Project Board and Other board types only

The A/D chip read block is designed for specific analog to digital converter chips that can be added to the prototyping area of Propeller boards.  This includes the ADC0831 [91]and MCP3002 [92]carried by Parallax, as well as other chips in the MCP3 line.

This block reports the voltage input on a channel of a supported A/D converter chip. It can be attached to a variable set block or used wherever a number value block is accepted. To use the block:

  • Select the A/D converter chip model you are using from the drop-down menu
  • Set the Propeller I/O pin numbers connected to the A/D chip's CLK, DO, DI and CS lines
  • Set the target channel on the A/D chip used. The options will vary depending on the A/D chip model chosen.

The value provided by the block is in volt-hundredths: if +2.50 volts is applied to the A/D channel, the block will provide a value of 250.  Unless the A/D chip set Vref block is used, this block assumes that the A/D chip's Vref pin is connected to +3.3 volts.


A/D chip set Vref

Propeller FLiP or Project Board and Other board types only

The A/D chip set Vref block is designed for specific analog to digital converter chips that can be added to the prototyping area of Propeller boards.  This includes the ADC0831 [91]and MCP3002 [92]carried by Parallax, as well as other chips in the MCP3 line.

This block is used to improve the accuracy of the value returned by the A/D chip read block and/or to use a different voltage (such as +5.0 volts) for the A/D chip's measurements.  Use this block before the A/D chip read block in your project, or at the beginning of your program to set the Vref value globally.  Enter the value of the voltage applied to the A/D chip's Vref pin. The number entered is in volt-hundredths; if +3.3 volts is applied to Vref, enter 330.

Pulse in / out

BlocklyProp reference Pulse in / out blocks

For Propeller Activity Board WX, FLiP and Other board types. Not available for Badge or Scribbler Robot board types.

The PIN menu on each of these blocks can be set to "other."  When "other" is chosen, the dropdown menu disappears and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:


pulse-in

The pulse-in block provides a value that represents a measurement of how long a pulse is in a low or high state in units of microseconds. The Propeller microcontroller begins measuring as soon as the PIN transitions into the state and stops and reports the measurement when it transitions out of the state.


pulse-out

The pulse-out block sends a pulse out on the PIN set by the drop-down menu. The value block sets the width of the pulse output in microseconds.


count pulses

The count pulses block provides the number of pulses detected over a certain period of time.

  • Choose the Propeller I/O pin to monitor for pulses in the dropdown; options will vary by board type.
  • Set how long to monitor that pin for pulses by putting a number value, variable, or expression that resolves to a number in the duration (ms) field.

PWM

BlocklyProp PWM (pulse width modulation) blocks

For Propeller Activity Board WX, FLiP and Other board types. Not available for Badge or Scribbler Robot board types. Not available for Badge or Scribbler Robot board types.


PWM set

This block launches a processor automatically. Each subsequent instance of this block changes the PWM behavior as configured, but does not launch an additional processor.

The PWM set block begins outputting a pulse-width modulated signal on the pin specified in the drop-down box with a duty cycle set by the value block is. For example, if the value block is set to 75, the PWM signal will be on 75% of the time and off 25% of the time. There are two PWM channels available on the Propeller microcontroller, so up to two PWM set blocks (one set to channel A and the other set to channel B) operating at one time. Setting the duty cycle to 0 (zero) turns the PWM signal off.

The PIN menu this block can be set to "other."  When "other" is chosen, the drop-down menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:

Note that the PWM Initialize block has been deprecated, and its functionality was added to the PWM set block


PWM stop

The PWM stop block stops the PWM process and frees up the resources it was using on the Propeller microcontroller.


 

Audio

BlocklyProp reference for AUDIO blocks

BlocklyProp blocks for generating audio. See each block for board type compatibility.


frequency out

Compatible with all Propeller board types

The frequency out block generates pulses of the specified frequency and duration on an I/O pin. An example use would be generating beeps on a piezospeaker.

  • PIN: select the Propeller I/O pin on which to send the signal. Options may vary by board type.
  • duration (ms): insert a value block to set the duration in milliseconds for the pulses to last.
  • frequency (Hz) insert a value block to set the frequency of the pulses, in Hertz. 

The PIN menu this block can be set to "other."  When "other" is chosen, the dropdown menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:


sound initialize

This block launches a processor automatically. Use only one instance of this block per project.

Compatible only with the Activity Board WX and Badge WX board types.

The sound initialize block starts the polyphonic (multi-tone) sound process.


sound play

Available for Activity Board WX, FLiP, and both Badge board types.

The sound play block controls the frequency, volume, and waveform generated on the selected channel.

  • Select the sound channel: A, B, C, or D
  • Select the action
    • set frequency:  (in Hz?)
    • set volume: (units? range?)
    • set waveform: sine, square, triangle, sawtooth, or noise
    • stop: stops generating the waveform

text to speech say

Using either text to speech block will launch one processor (only one total, NOT one per block).

   For the Hackable Electronic Badge and Badge WX.

The TTS say block phonetically pronounces the letter characters in the attached text string block.


text to speech spell

Using either text to speech block will launch one processor (only one total, NOT one per block).

  For the Hackable Electronic Badge and Badge WX.

The TTS spell block pronounces each letter character from left to right in the attached text string block.


WAV play

This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.

This block launches TWO processors automatically.

The WAV play block does the following:

  • Sets up the microSD card reader connection for the specified board type
  • Sets up the WAV player object in the Propeller microcontroller
  • Plays the WAV formatted audio file from the SD card whose filename was typed into the block. 

The WAV file on the microSD card must be in the correct format.

Options from our Sound Library reference section: [93]

  • Download pre-formatted files from the Sound Library
  • Re-format your audio files with the free Audacity software - tutorial
  • Create your own new audio files with Audacity - tutorial

WAV blocks must be used with other types of blocks.

The WAV play block launches processors to manage the SD card and generate the audio output.  However, once the first processor has launched the others, it will shut itself down if it does not have any other blocks to execute. This breaks the project, and instead of hearing your audio track, you will just hear a buzzing sound.  To avoid this, the first processor must keep running. 

If your project does other things, like blink lights or make a robot move, your WAV file will play as long as other code keeps running.

If your project does NOT do other things and all you want to do is play the WAV file, do one of these two things:

  • Follow the WAV play block with an empty repeat forever block to play just one file, if you don't know how long it lasts.
  • Follow the WAV play block with a pause block with a duration lasting longer than your audio track. You can alternate WAV play blocks and pause blocks to play a series of WAV files.

WAV status

This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.

The WAV status block provides a value of 1 (one/true) if a WAV file is currently playing and a value of 0 (zero/false) if a WAV file is not currently playing.


WAV volume

This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.

The WAV volume block set the volume of the Propeller’s WAV player. A value of 0 is quietest, and 10 is loudest.


WAV stop

This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.

The WAV stop block stops playing a WAV file.


WAV set pins

Compatible only with the Activity Board WX

The WAV set pins block is used only at the beginning of your program to send the WAV file player output to different pins.


Servo

BlocklyProp reference for SERVO blocks

Block and I/O pin availability varies by board type.

The PIN menu on these blocks can be set to "other."  When "other" is chosen, the dropdown menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:


Standard servo

This block launches a processor automatically; using up to 14 servos on different Propeller I/O pins will not launch additional processors.

Use this block with the Parallax Standard Servo (#900-00005) [94] and the Propeller Activity Board WX, Propeller FLiP, S3 Robot, and Other board types. Not available for the Badge board type.

 The standard servo block sends control pulses to position a Parallax Standard Servo.

  1. Set the PIN drop-down to the Propeller I/O pin number connected to the servo's signal pin.
  2. Set the angle for the servo to turn to and hold by inserting a number value in the range of 0 to 180.

Once set, the control pulses will continue until the program encounters another standard servo block or servo disable block for that servo's Propeller I/O pin.


CR servo speed

This block launches a processor automatically, using up to 14 instances of this block will not launch additional processors.

Use this block with the Parallax Continuous Rotation Servo (#900-00008) [95] and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The CR servo speed block sends control pulses to a servo connected to PIN selected by the drop-down menu that tells the servo what speed in which direction to turn. Negative speeds turn the CR (Continuous Rotation) servo clockwise, and positive speeds turn the servo counter-clockwise. A speed of 0 (zero) stops the CR servo. The speed can be from -200 to 200.  In most cases, you will notice most of the change in speed from -100 to 100.

The CR servo speed block sends pulses to control speed and direction of a Parallax Continuous Rotation servo.

  1. Set the PIN dropdown to the Propeller I/O pin number connected to the servo's signal pin. Pin availability will vary with board type.
  2. Set the speed for the servo to rotate by inserting a number value in the range of -200 to +200, though a change in speed is most noticeable from -100 to +100.
    • Negative numbers turn the servo counter-clockwise
    • positive numbers turn the servo clockwise
    • Zero makes the servo hold still.*

Once set, the control pulses will continue until the program encounters another standard servo block or servo disable block for that servo's Propeller I/O pin.

*If your Parallax CR Servo rotates slowly or buzzes when set to zero, you may need to center it. Very gently, insert a Philips tip screwdriver into the access hole in the servo's case and slightly twist the potentiometer until the servo holds still.


CR servo set ramp

Use this block with the Parallax Continuous Rotation Servo (#900-00008) [95] and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The CR servo set ramp block sets the maximum amount that the CR servo’s speed connected to the PIN specified in the drop-down menu can be changed each update cycle. A rampstep of 1 means that the servo’s speed can only change 1 unit every 20ms - meaning that its response will be very sluggish. A rampstep between 4 and 8 is a good compromise between responsiveness and protecting the servo from sudden speed changes that can damage the servo.


Feedback 360° servo initialize

This block launches a processor automatically, using up to 4 instances of this block will not launch additional processors.

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) [96] and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. 

The Feedback 360° servo initialize block sets up communication between the servo and the Propeller microcontroller. If you forget to use this block in your project, a triangle warning will appear on other Feedback 360° servo blocks as a reminder.

  • Set the PIN dropdown to the Propeller I/O pin connected to the servo's control signal wire — the white wire in the 3-wire cable.
  • Set the FB dropdown to the Propeller I/O pin connected to the servo's feedback signal wire — the single yellow wire.

Feedback 360° servo configure

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) [96] and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The Feedback360° servo configure (formerly setup) block sets the maximum value for the servo behavior chosen.

  • First, set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.
  • Then, select behavior from the second drop-down.
    1. acceleration (°/s2) determines how quickly the servo will transition to a new speed setting, in units of degrees per second squared.  The valid range is 600 to 7200.
    2. max speed (°/s) determines the maximum rotation speed in units of degrees per second, independent of direction.  The valid range is 1 to 1080.
    3. turn count (+/- revolutions) changes the number of turns that have elapsed since the application has started; use it to reset to zero.
    4. home to position (+/-°) determines the home position's offset from the servo's mechanical 0-degree position. If not configured, the home position is the angle measured when the servo was initialized.
    5. kP for speed determines the proportional constant for the velocity control system. The default value is 500.
    6. kI for speed determines the integral constant for the velocity control system. The default value is 0.
    7. kD for speed determines the derivative constant for the velocity control system. The default value is 0.
    8. I for speed max determines the maximum integral output constant for the velocity control system. The default value is 0.
    9. kP for position determines the proportional constant for the angular control system. The default value is 12000.
    10. kI for position determines the integral constant for the angular control system. The default value is 600
    11. kD for position determines the derivative constant for the angular control system. The default value is 6000
    12. I for position determines the maximum integral output constant for the angular control system. The default value is 1000.
  • Last, insert a value block to configure the chosen behavior. Note that some behavior options have range limits on the value accepted.

Feedback 360° servo set

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) [96] and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The Feedback360° servo setup block sets the value for the servo behavior chosen.

  • First, set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.
  • Then, select behavior from the second drop-down.
    • speed: sets the continuous rotation speed in degrees per second. Positive values turn counterclockwise and negative values turn clockwise.  When speed is chosen, insert a value block, or any variable or equation that resolves to a value.  Cap the value used here by the project with the Feedback 360° servo setup block.
    • set angle to: sets the servo to the angle specified by the attached value block.  The origin for the angle is the position the servo was in when initialized. Positive values turn counterclockwise and negative values turn clockwise. 
    • change position by: rotates the servo by the number of degrees specified by the attached value block. Positive values turn counterclockwise and negative values turn clockwise. 

Feedback 360° servo get position

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) [96] and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The Feedback 360° servo get position block provides the angular position of the specified servo.  The origin for the angle is the position the servo was in when initialized.  Set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.


Feedback 360° servo status

The Feedback 360° servo status tests whether the servo is (1/true) or is not (0/false) in the state chosen from the drop-down menu. This block does not change the servo's behavior but merely observes. 

  • First, set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.
  • Then, select behavior to test from the second drop-down:
    • turning a speed
    • moving to a position
    • holding at a position

servo disable

The servo disable block stops any servo control signals being sent by the Propeller I/O pin chosen in the drop-down.  The servo disable block does NOT free up the processor that was launched by the Standard servo or CR servo speed block.


Robot

BlocklyProp reference for ROBOT blocks

These blocks are ONLY available for the Propeller Activity Board WX board type.

  • These blocks ARE compatible with the original and WX versions of the Activity Board. See the BlocklyProp Robotics with the ActivityBot [38] tutorial for many examples of these blocks in use.
  • Check which ActivityBot version you have.
    • Some blocks and settings are only for the ActivityBot 360° (#32600). Its Feedback 360° servos have internal encoders with a total of 4 wires. 
    • Some blocks and settings are for the original ActivityBot with external 3-wire encoders (#32500). Be sure
  • These blocks are NOT compatible with the Scribbler S2 or S3 robot. See the Scribbler S3 Block Reference [1]for more info.

Robot initialize

This block launches a processor automatically. Use only on instance of this block per project.

The Robot initialize block is used to set up the robot to drive.  If you forget to use this block at the beginning of your navigation programs, a triangle warning will appear on Robot drive... blocks as a reminder.

Choose a robot option from the drop-down:

  • ActivityBot: The original ActivityBot robot (#32500) [97] with external 3-wire encoders must be calibrated before use.  This can be done using the ActivityBot calibrate block (below).  The ActivityBot calibrate block is used by itself (it does not need the Robot initialize block).
  • ActivityBot 360°: The ActivityBot 360° (#32600) [37] with 4-wire Feedback360° servos and no external encoders. This robot does not get calibrated.
  • Arlo: for use with the Arlo Complete Robot System (#28966) [98], including the DHB-10 motor controller and the Propeller Activity Board WX.
  • Servo Differential Drive: Any Propeller-controlled robot** with two wheels that are driven with Parallax continuous rotation servos. Choosing this option will expand the block so you can specify the Propeller I/O pins driving the servos.

**See top of the page for Propeller board specifics.


Robot set acceleration

The Robot set acceleration block is used to set how quickly the motors change their speeds.

  • The first drop-down determines whether this acceleration setting is for use with Robot drive speed blocks or Robot drive distance blocks. 
  • The second drop-down menu sets the acceleration in units of ticks per second squared.  The range is 100 ticks/s2 to 2000 ticks/s2.

With the ActivityBot, when using Robot drive speed the default acceleration is 600 ticks/s2 unless changed with this block.  Likewise, with the ActivityBot using Robot drive distance the default acceleration is 400 ticks/s2 unless changed with this block.


Robot drive speed

The Robot drive speed block sends control pulses to the robot's servos that tells the servos what speed in which direction to drive.  Negative speeds drive the wheels backward, and positive speeds drive the wheels forward.  Turns can be accomplished by setting the wheels at different speeds.  A speed of 0 (zero) stops the wheel*.  

  • For the ActivityBot, the speeds are roughly linear from 0 (stopped) to +/-128 (full speed and the maximum value used). The default acceleration is 600 encoder ticks/s2 unless changed with the Robot set acceleration block.
  • For the Arlo Robot, the speeds are (to be determined!)
  • For the Servo DIfferential Drive, the speed can be from -128 to 128, but In most cases, you will notice most of the change in speed from -100 to 100.  This depends greatly on the type of servo or motor controller being driven.

Robot drive speed and Robot drive distance don't mix!  Use a Robot drive stop block in between them first, if you if you want your ActivityBot to switch from using one type of navigation to the other.

*If your Parallax CR Servo rotates slowly or buzzes when set to zero, you may need to center it. Very gently, insert a Philips tip screwdriver into the access hole in the servo's case and slightly twist the potentiometer until the servo holds still.


Robot drive distance

The Robot drive distance block makes the wheels of a robot drive a specific distance.  This block only works with robots that have encoders: ActivityBot and Arlo.  It does not work with Servo Differential Drive.

For the ActivityBot Robot:

  •  Units are in single encoder ticks, which are 3.25 mm long.
  • The default drive speed is 64 ticks per second unless changed with the Robot set speed block.
  • The default acceleration is 400 ticks/s2 unless changed with the Robot set acceleration block.

Robot drive speed and Robot drive distance don't mix!  Use a Robot drive stop block in between them first, if you if you want your ActivityBot to switch from using one type of navigation to the other.


    Robot set maximum speed

    The Robot set maximum speed block affects the drive speeds of two types of blocks, depending on the drop-down selection.

    • Choose speed to set a maximum value that will be used with Robot drive speed blocks.  The default max speed for Robot drive speed blocks is +/- 128 ticks per second unless changed to a smaller value with this block.
    • Choose distance to change the drive speed used by Robot drive distance blocks. The default speed for Robot drive distance is 600 ticks per second unless changed with this block, but will not exceed 128 ticks per second.

    Robot drive stop

    The Robot drive stop block makes both right and left wheels stop turning.


    Robot encoder counts

    The Robot encoder counts block stores the current encoder count values in ticks, in the specified variables.


    ActivityBot calibrate

    Choose the supported robot from the drop-down menu:

    • ActivityBot 360°: for use with the ActivityBot 360° robot (#32600) [37] which uses Feedback 360° servos but no external encoders. Calibration is recommended but optional before running other navigation programs.
    • ActivityBot: for use with the ActivityBot robot (#32500) [97] which has external encoders. The ActivityBot MUST be calibrated before running other navigation programs.
    • ActivityBot 360° (Parallaxy): for use with the Parallaxy Telepresence Robot (#32800) [99]. The robot MUST be built according to these letsrobot.readme.io instructions [100] before calibration and use with the Parallaxy + Raspberry Pi + LetsRobot.tv system.

    This block must be run as its own program with no other blocks. 


    ActivityBot display calibration

    The ActivityBot calibrate block is ONLY for use with the ActivityBot robot (#32500), the ActivityBot 360° robot (#32600) [37], and the Parallaxy Telepresence Robot (#32800) [99]

    The ActivityBot display calibration block displays information about the calibration values stored in the Activity Board's onboard EEPROM.  This block must be run as its own program, and it will display information to the terminal window when run.

    • Choose the correct robot from the first dropdown
      • ActivityBot 360°
      • ActivityBot
      • ActivityBot 360° (Parallaxy)
    • Choose the type of information to display
      • results: option displays messages about whether your robot calibrated successfully, and if not, what might be wrong.
      • data: displays the actual calibration values stored in EEPROM. These values may be useful if you are trying to troubleshoot a calibration problem with the help of Parallax tech support staff.

    Load firmware

    Currently, the Load firmware block is ONLY for use with the Parallaxy Telepresence Robot (#32800) [99] . The code MUST be loaded to EEPROM.  The block loads the Parallaxy firmware for interacting with a Raspberry Pi, which itself is programmed to work with LetsRobot.TV. For more information on Parallaxy software setup, see its letsrobot.readme.io pages here [101].

    System

    BlocklyProp reference for SYSTEM blocks

    Block availability varies by board type.

    Using most of the System blocks requires a good understanding of the Propeller chip's 8-core architecture. See the P8X32A Propeller Datasheet [15] or the Propeller Manua [102]l for detailed information. The User Defined Code block requires some understanding of Propeller C programming. See the Propeller C Tutorials [103] as a resource.


    Wait until counter

    Only available for the Other board type.


    The Wait until counter block pauses program execution until a timing event is reached. Most of the time it is used with the system counter block and an inserted value. This technique can guarantee a specific number of system clock ticks elapse before code execution continues. It can also be used to coordinate code execution in separate cores, where both processes pause until the system counter reaches the same specified value.


    cog set register

    Only available for the Other board type.

    The cog set register block allows you to set the value of the read/write Cog RAM register selected from the drop-down menu.

    • pin output: I/O pin output states for P31-P0 (OUTA)
    • pin direction: I/O pin directions for P31-P0 (DIRA)
    • counter A: Counter A control (CTRA)
    • counter B: Counter B control (CTRB)
    • frequency A: Counter A frequency (FRQA)
    • frequency B: Counter B frequency (FRQB)
    • phase accumulator A: Counter A phase (PHSA)
    • phase accumulator B: Counter B phase (PHSB)

    Each Propeller core has its own set of registers; this block interacts with the core executing the block code. See the Cog RAM Special Purpose Registers in the P8X32A Propeller Datasheet [15] or the Propeller Manua [102]l for detailed information on these registers.


    cog get register

    Only available for the Other board type.

    The cog get register block retrieves the value from the read-only or read/write Cog RAM register selected from the drop-down menu:

    • pin input:  I/O pin input states for P31-P0 (INA, read-only)
    • pin output: I/O pin output states for P31-P0 (OUTA)
    • pin direction: I/O pin directions for P31-P0 (DIRA)
    • counter A: Counter A control (CTRA)
    • counter B: Counter B control (CTRB)
    • frequency A: Counter A frequency (FRQA)
    • frequency B: Counter B frequency (FRQB)
    • phase accumulator A: Counter A phase (PHSA)
    • phase accumulator B: Counter B phase (PHSB)

    Each Propeller core has its own set of registers; this block interacts with the core executing the block code. See the Cog RAM Special Purpose Registers in the P8X32A Propeller Datasheet [15] or the Propeller Manua [102]l for detailed information on these registers.


    system

    Only available for the Other board type.

    The system block can provide one of two different values based on your drop-down menu choice.

    • system counter provides the current system counter value at the moment it is asked for. When the system counter reaches 4,294,967,295, it resets back to zero. The Propeller chip's system counter increases by 1 for every system clock “tick.”  There are 80,000,000 ticks every second on the Propeller Activity Board, Propeller FLiP, Propeller Project Board USB, and any Propeller board using a 5 MHz oscillator running at PLL16x. 
    • system clock frequency provides the clock frequency in use by your Blockly project.

    This block appears in the System menu for the Other board type. It appears in the Values menu for the Activity Board, FLiP, and Badge board types. It is not available for the S3.  For a tutorial using this block, see the Precision Timing with the Propeller [104] tutorial.


    user defined code

    Compatible with all Propeller board types (except Scribbler Robot)

    This block allows you to integrate your custom C code with your BlocklyProp code. 

    • It is helpful to have an understanding of Propeller C if you wish to use this block. Click here [105] to learn more about Propeller C.

    Using this block often requires you switch between the block and code views to ensure that the custom code you are entering into the fields of this block is placed into the parts of your program that you expect.

    • Check the box to open this block's menu system.
    • In the label field, enter a name for your custom code block.

    Checking the box of any one of the menu items in this block will open more options for your code.

    The label field lets you change the text displayed on your new user defined block.

    Block color lets you color-match your custom code block to the existing palette.

    The includes code, globals code, setups code, main code, and functions code menu options open up a mini code editor for inserting C code.

    • Code entered in the includes code field is placed at the very beginning of your program. It is meant for library inclusions and defined constants using #include and #define.
      • Included libraries must be available in the BlocklyProp branch of SimpleLibraries [106], as those are the only libraries BlocklyProp can access.
    • Code entered in the globals code field is placed before the main() function. Enter any global variables, structures, forward declarations, or objects here.
    • Code entered in the setups code field is placed immediately after the main() function, but before inline code generated by most blocks.
      • Some blocks generate setup code. The order of any blocks that generate setup code (top to bottom, then left to right) determines the order in which that generated setup code is placed.
    • Code entered in the main code field is placed inside of the main() function at the position determined by the block in relation to other blocks in your program.
      • In the main code pane, you may enter inline code, a numerical value, or a string value. If you choose numerical or string value, the block shape will transform (as shown below), allowing you to attach it to any blocks that accept the corresponding value type. 

    ​

      • If you choose for your main code to be a numeric or string value, do NOT end your statement with a semicolon. If you do, it will be treated as a value.
      • If you choose for your code to return a numeric value, be sure that it is already an int type variable, or use (int), to cast it as an int. 
      • If you choose for your code to return a string value, be sure that your code is returning a *char or char[] value
    • Code entered in the functions code field is placed after the main() function.
      • Functions code should consist of full functions.
      • Any functions you create must have a matching forward declaration entered into the globals code field.

    The inputs drop-down allows you to add up to 9 inputs to your custom code block.

    To access the values received in the inputs, add @1, @2, @3, etc. (corresponding to the input's number) into any of the code fields in the block. The @1, @2, @3, etc. is replaced with the code generated by whatever block you place in that input.

    • To add an @ into your code, type @@. The @@ will then be replaced with a single @.

    When you uncheck the box at the top of the block, you will see the block as you designed it to appear.  The shape, color, labels, and inputs you specified will be displayed:

    The block's inputs are external by default. Right-click your block and choose "inline inputs" to set the inputs inline.

    • If the block's inputs are set to "inline," then the block will appear very strange when the block's menu system is opened up. To prevent or correct this, right-click the block and reset the block's inputs to external.

    DISCUSSION FORUMS | PARALLAX INC. STORE

    About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2019


    Source URL: https://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference

    Links
    [1] http://learn.parallax.com/support/reference/scribbler-3-robot-block-reference
    [2] http://blockly.parallax.com
    [3] https://learn.parallax.com/ab-blockly-intro
    [4] https://learn.parallax.com/node/1850
    [5] https://learn.parallax.com/s3-blockly-intro
    [6] https://learn.parallax.com/support/reference/scribbler-3-robot-block-reference
    [7] https://learn.parallax.com/support/download/1741/blocklyprop-faq-schools
    [8] https://www.parallax.com/downloads/propeller-activity-board-wx-product-guide
    [9] https://www.parallax.com/downloads/propeller-activity-board-guide
    [10] https://www.parallax.com/downloads/propeller-flip-module-product-guide
    [11] https://www.parallax.com/downloads/propeller-project-board-usb-product-guide
    [12] https://www.parallax.com/downloads/scribbler-s3-robot-info-poster
    [13] https://www.parallax.com/downloads/hackable-electronic-badge-product-guide
    [14] https://www.parallax.com/downloads/badge-wx-product-guide
    [15] https://www.parallax.com/downloads/p8x32a-propeller-datasheet
    [16] http://learn.parallax.com/ab-blocks/values
    [17] http://learn.parallax.com/ab-blocks/variables
    [18] http://learn.parallax.com/ab-blocks/arrays
    [19] http://learn.parallax.com/ab-blocks/functions
    [20] http://learn.parallax.com/tutorials/language/blocklyprop/blocklyprop-functions-and-multicore
    [21] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/control
    [22] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/servo
    [23] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/robot
    [24] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/sensor/colorpal
    [25] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/sensor/gps
    [26] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/sensor/sound-impact-sensor
    [27] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/sensor/rfid
    [28] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/communicate/protocols
    [29] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/communicate/rgb-leds
    [30] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/communicate/xbee
    [31] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/communicate/wx-wifi/advanced-wx
    [32] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/analog-pulses/voltage
    [33] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/analog-pulses/pwm
    [34] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/audio
    [35] http://learn.parallax.com/tutorials/language/blocklyprop/simple-blocklyprop-programs-propeller-boards/variable-blocks
    [36] http://www.parallax.com/product/900-00360
    [37] http://www.parallax.com/product/32600
    [38] http://learn.parallax.com/tutorials/robot/activitybot/blocklyprop-robotics-activitybot
    [39] http://blockly.parallax.com/
    [40] https://github.com/parallaxinc/BlocklyProp
    [41] https://github.com/parallaxinc/BlocklyPropClient
    [42] https://github.com/parallaxinc/Cloud-Compiler
    [43] http://www.asciitable.com
    [44] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/about-naming-things
    [45] http://www.parallax.com/product/20300
    [46] http://learn.parallax.com/tutorials/language/blocklyprop/simple-blocklyprop-programs-propeller-boards/graphing-data
    [47] http://www.parallax.com/product/28087
    [48] http://learn.parallax.com/tutorials/language/blocklyprop/oled-display-blocklyprop
    [49] http://www.parallax.com/product/28085
    [50] http://www.parallax.com/product/28086
    [51] https://www.parallax.com/product/27976
    [52] https://www.parallax.com/product/27977
    [53] https://www.parallax.com/product/27979
    [54] http://www.parallax.com/product/32420D
    [55] http://www.parallax.com/product/32420S
    [56] https://www.parallax.com/product/32416
    [57] https://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/communicate/protocols
    [58] http://www.parallax.com/product/27800
    [59] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/2-axis-joystick/joystick-wiring-example
    [60] http://www.parallax.com/product/27899
    [61] https://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/sensor/4-x-4-keypad/4x4-keypad-wiring
    [62] http://www.parallax.com/product/28380
    [63] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/colorpal/colorpal-wiring-code-example
    [64] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/values
    [65] https://www.parallax.com/product/29126
    [66] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/fingerprint-scanner/fingerprint-scanner
    [67] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/gps/gps-wiring-example-code
    [68] https://learn.parallax.com/tutorials/language/blocklyprop/getting-started-blocklyprop-activity-board-wx/more-blocklyprop
    [69] https://learn.parallax.com/sites/default/files/content/AB-Blockly/Waveshare-NEO-7M-GPS-Data-Example.zip
    [70] https://www.parallax.com/product/29133
    [71] http://www.parallax.com/product/28065
    [72] https://www.parallax.com/downloads/mma7455-3-axis-accelerometer-module-documentation
    [73] http://www.parallax.com/product/28017
    [74] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/memsic-2-axis/memsic-2125-wiring-example
    [75] http://www.parallax.com/555-28087
    [76] http://www.parallax.com/product/28083
    [77] http://www.parallax.com/product/28032
    [78] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/pir/pir-wiring-example-code
    [79] https://www.parallax.com/product/28015
    [80] http://www.parallax.com/product/28041
    [81] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/ping-distance/ping-wiring-example-code
    [82] https://www.parallax.com/product/28140
    [83] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/rfid/rfid-wiring-example-code
    [84] https://www.parallax.com/product/32390
    [85] https://www.parallax.com/product/020-00001
    [86] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/sony-remote/ir-remote-wiring-example-code
    [87] http://www.parallax.com/product/29132
    [88] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/sound-impact-sensor/sound-impact-wiring
    [89] http://www.parallax.com/product/28059
    [90] http://learn.parallax.com/tutorials/language/blocklyprop/circuit-practice-blocklyprop/read-potentiometer-rc-time
    [91] http://learn.parallax.com/tutorials/language/blocklyprop/tilt-tones-blocklyprop
    [92] https://www.parallax.com/product/603-00039
    [93] https://learn.parallax.com/support/reference/sound-library
    [94] https://www.parallax.com/product/900-00005
    [95] https://www.parallax.com/product/900-00008
    [96] https://www.parallax.com/product/900-00360
    [97] http://www.parallax.com/product/32500
    [98] http://www.parallax.com/product/28966
    [99] http://www.parallax.com/product/32800
    [100] https://letsrobot.readme.io/docs/build-parallaxy
    [101] https://letsrobot.readme.io/docs/parallaxy-software
    [102] https://www.parallax.com/downloads/propeller-manual
    [103] http://learn.parallax.com/tutorials/propeller-c
    [104] http://learn.parallax.com/tutorials/language/blocklyprop/precision-timing-propeller
    [105] http://learn.parallax.com/tutorials/language/propeller-c/propeller-c-start-simple
    [106] https://github.com/parallaxinc/Simple-Libraries/tree/BlocklyProp/Learn/Simple%20Libraries