Code 39 barcode generation block

i made a relatively simple custom block that (with help from a global lookup table) generates code 39 barcodes with the pen

i was previously trying to make a barcode scanner for code 128, which does technically work but it's extremely unreliable, i gave up on that and made this instead which was much easier and actually works

here i've used it to make a barcode that says "hello snap forums" (actually it's in all uppercase because code 39 doesn't support lowercase text)

here it is in the editor: Snap! Build Your Own Blocks - you can export blocks and it will give you both the actual block and the lookup table, so you can use it in other projects (i'm not sure if there's any real use for this but it'd be cool if there is!). but you have to also turn on the "flat line ends" option in your project, otherwise it will just create a mess [it does this by itself now!]

Very smart use of pen width!

Pretty Snazzy!

There's more than one barcode code? I learn something every day...

Down at the bottom of Sensing there is a block
untitled script pic (6)

yeah, there's quite a lot of different barcode types! i chose this one to implement because it's very simple (one character = one pattern in the code, no checksums) but it can represent some text as well (compared to upc-a barcodes used on product packaging for example, which can only encode numbers)

thanks for the hint about the flat line ends block, i've modified the custom block to turn it on at the start and put it back to how it was before at the end

Full ASCII Code 39

if you want to encode the letter e you have to encode +E

It's funny to me how ASCII just won't die. I mean, ASCII killed EBCDIC pretty much instantly, despite IBM's preference for the latter. But, let's face it, writing code that uses Unicode is just really hard! All those lookalike glyphs, right-to-left languages... too much to think about. So everybody still uses ASCII for many purposes.