Include upc.scad in your model with the use command. See the UPC/EAN user-guide for more details. OpenSCAD can generate 2D vector graphics with a few caveats. To generate any of the barcodes using 2D ...
A barcode encoding library supporting over 50 symbologies including Code 128, Data Matrix, USPS OneCode, EAN-128, UPC/EAN, ITF, QR Code, Code 16k, PDF417, MicroPDF417, LOGMARS, Maxicode, GS1 DataBar, ...