Skip to main content

The Complete Guide to CNC Machining Surface Finishing in 2026

The Complete Guide to CNC Machining Surface Finishing in 2026 | Simple Circuits
CNC Machining · Surface Finishing · Precision Manufacturing

The Art of
Surface Finishing
in CNC Machining

From raw-milled aluminum to mirror-polished aerospace brackets — the complete guide to CNC surface finishing, every process JUSTWAY offers, and how to choose the right finish for your part in 2026.

Nitin Sharma
Simple Circuits
June 2026
14 min read
Scroll
Brought to you by  JUSTWAY.com Professional CNC machining with 10+ surface finishes. Instant quote, parts from $1.

A CNC-machined part fresh off the machine is rarely finished. The raw surface — covered in visible tool marks, micro-burrs, and machining lines — is just the beginning. What transforms a precision-cut piece of aluminum or stainless steel into a product-ready component is surface finishing: the family of post-machining processes that change how a part looks, how it performs, and how long it lasts.

In 2026, surface finishing is no longer an afterthought. Engineers, designers, and product teams specify finishes at the design stage because the wrong choice can compromise tolerances, reduce corrosion resistance, add unnecessary cost, or fail a client's aesthetic brief entirely. Getting it right the first time requires understanding what each process actually does — to the surface, to the dimensions, and to the material.

This guide covers everything: the science behind surface roughness, every finish JUSTWAY offers for CNC parts, material compatibility, design rules, real-world use cases, and a step-by-step ordering guide. JUSTWAY operates CNC machining facilities in Hangzhou, Shenzhen, and Shanghai with over 700 machines from brands including Mazak, Okuma, and Makino — and their online quoting platform makes professional-grade surface finishing accessible to anyone.


Section 01

What Is Surface Roughness and Why Does It Matter?

Before choosing a finish, you need to understand what you're actually changing. Surface roughness — measured as Ra (roughness average) in micrometers or microinches — is the quantified measure of the microscopic peaks and valleys left on a machined surface. Every cutting operation leaves a characteristic roughness profile, and that profile directly determines how the part behaves in service.

A high Ra value means a rough surface with deep peaks and valleys. A low Ra value means a smoother surface. Standard CNC milling produces Ra 3.2 μm (125 μin) — the default "as-milled" condition. From there, post-machining finishing operations can improve roughness down to Ra 1.6 μm (63 μin) through smooth machining, or all the way to optical-quality surfaces through polishing.

Precision CNC machined gears and shafts surface finishing
▲ CNC machined precision parts — Ra surface values determine performance, fit and appearance
Corrosion Resistance

Rough surfaces have more exposed area for oxidation and chemical attack. Smooth or coated surfaces dramatically reduce the rate of corrosion — critical for stainless steel and aluminum parts in wet or chemical environments.

Friction and Wear

For moving parts — shafts, bearings, sliding surfaces — roughness directly controls friction coefficient and wear rate. Over-rough surfaces abrade faster; over-smooth surfaces can actually reduce oil retention and increase wear in certain contact configurations.

Fatigue Strength

Surface roughness peaks act as stress concentrators under cyclic loading. Finishing to a lower Ra removes these peaks and significantly extends fatigue life — a primary reason aerospace and automotive structural components receive specific finishing specifications.

Dimensional Tolerances

Every surface finish adds a layer or removes material — sometimes only microns, sometimes hundreds of microns. Understanding build-up (coatings) versus material removal (machining, blasting) is essential when tight tolerances are specified. This is why JUSTWAY follows ISO 2768/GB/T1804 and flags finish interactions during DFM review.

Aesthetics and Brand Perception

For consumer products, luxury hardware, and customer-facing components, surface finish is a direct proxy for perceived quality. A brushed aluminum enclosure communicates premium engineering. A raw-milled surface communicates prototype. The finish is often the first and last thing a customer evaluates.

The Ra rule of thumb: Standard as-milled CNC parts are Ra 3.2 μm (125 μin). Smooth machining brings this to Ra 1.6 μm (63 μin) — and JUSTWAY can achieve Ra 0.4 μm (15.7 μin) on request for critical surface applications. Specify the Ra requirement on your technical drawing when tolerances are critical.


Section 02

Standard (As-Milled) — The Default Starting Point

The fastest, cheapest, and most dimensionally faithful finish option is no additional finish at all. Standard as-milled condition delivers parts with Ra 3.2 μm (125 μin) surface roughness, visible tool marks from the milling or turning operation, and minimal dimensional change — because nothing is added to or removed from the surface beyond the machining operation itself.

By default, JUSTWAY removes sharp edges and burrs on all as-milled parts before shipping. This means you receive a dimensionally accurate, safe-to-handle part that's ready for functional testing immediately. What it isn't ready for: cosmetic presentation, corrosion-exposed environments, or applications requiring tight surface contact.

CNC milling machine cutting metal with coolant as-milled surface
▲ CNC milling machine in action — standard as-milled output, Ra 3.2 μm (125 μin)
Standard Finish Specs

As-Milled — JUSTWAY's Default CNC Output

When speed and dimensional accuracy take priority over appearance or environmental protection, as-milled is the right call. It's the baseline every other finish is measured against.

Ra 3.2μm
Surface Roughness
125μin
In Microinches
Zero
Coating Buildup
Fastest
Turnaround

When to choose as-milled: Internal structural components, jigs and fixtures, prototype iterations where you're validating geometry not surface quality, and any part where coating buildup would affect mating tolerances. Also the correct choice when you plan to post-process the part yourself after receiving it.


Section 03

Smooth Machining — Precision Surface Finishing

When the as-milled surface isn't smooth enough for a given application, smooth machining is the first upgrade. A finishing CNC machining operation is applied after the primary cut — using finer toolpaths, higher spindle speeds, and lighter cuts to reduce surface roughness. The standard smooth machining output at JUSTWAY is Ra 1.6 μm (63 μin), and this can be reduced to Ra 0.4 μm (15.7 μin) on a case-by-case basis upon request.

The key benefit over purely mechanical post-processing (like sanding) is that smooth machining maintains dimensional accuracy — the cut removes a controlled, predictable amount of material. The result improves both the aesthetics of the product and the precision of critical surfaces, particularly for parts that are visible or require a high degree of dimensional consistency.

Smooth machined precision aluminum manifold block CNC surface finishing
▲ Smooth machined aluminum block — Ra 1.6 μm, sealing surfaces and precision features
Process: Finish Cutting Pass

A dedicated finishing pass uses a cutting tool with a finer stepover, higher speed, and lower feed rate than the roughing pass. The result is that machining peaks and valleys from the primary cut are removed, leaving a much more uniform surface texture.

Handling Requirement

JUSTWAY's documentation specifically notes that smooth-machined parts should be handled with care — gloves or clean dry hands — and stored away from humidity and temperature fluctuations to avoid warping or surface damage. The smoother the surface, the more visible any subsequent handling marks become.

Best Applications

Sealing surfaces, mating faces in assemblies, parts requiring precise surface contact (O-ring grooves, bearing housings), and any cosmetically visible aluminum or steel surface that doesn't require a color coating. Smooth machining is also the prerequisite for polishing and many coating operations.


Section 04

Anodizing — Corrosion Protection with Color

Anodizing is the most widely used surface treatment for aluminum CNC parts — and with good reason. It's an electrochemical process that converts the outermost layer of aluminum into aluminum oxide: a hard, porous, corrosion-resistant ceramic layer that's integral to the part surface rather than applied on top of it. This means it won't chip, peel, or flake the way paint or plating can.

JUSTWAY offers anodizing in multiple variants — standard anodizing, bead blast + anodized color, and electrically conductive oxidation — each optimized for different application requirements. The most common color options are clear, black, red, and gold, though custom colors are available on request.

Anodized aluminum keys in gold cyan and purple colors
▲ Anodized aluminum parts — hard oxide layer with vibrant color options including gold, cyan and purple

Standard Anodizing

Creates a corrosion-resistant aluminum oxide layer directly on the part surface. Available in clear, black, red, and gold. Adds minimal dimensional buildup (~5–25 microns per side) — must be accounted for in tight-tolerance features.

Bead Blast + Anodized Color

The premium combination. Bead blasting first creates a uniform matte texture across the entire surface, removing any machining marks. Anodizing then locks in a rich, consistent color over the uniform matte base. This is the finish used on premium consumer electronics and aerospace panels.

Electrically Conductive Oxidation

A specialized variant for aluminum parts that must remain electrically conductive while still being protected from corrosion. The film produced is only 0.01–0.15 micrometers thick — negligible dimensional impact. Essential for EMI shielding housings, grounding components, and aerospace electrical connectors.

Anodizing is aluminum-only: Standard anodizing applies to aluminum alloys. Stainless steel, titanium, copper, and brass require different surface treatment processes. JUSTWAY's quoting platform filters available finishes by material automatically — but always double-check material compatibility before specifying a finish on your drawing.


Section 05

Bead Blasting — Uniform Matte Texture

Bead blasting (also called shot blasting or bead peening) propels fine abrasive beads against the part surface at high velocity using compressed air. The impact of thousands of small beads per second creates a uniform, matte texture across the entire surface — eliminating machining marks, scratches, and surface irregularities without removing significant material.

Unlike smooth machining which refines the cut surface, bead blasting replaces the machined texture with a consistent dimpled pattern. The result is a part with a professional, uniform appearance that catches light evenly rather than showing directional machining lines. It's both a functional and cosmetic treatment.

Bead blasted metal surface uniform matte texture close up
▲ Bead blasted metal surface — uniform matte dimple texture, all machining marks eliminated
Materials: Metals and Plastics

JUSTWAY offers bead blasting for both metals (aluminum, stainless steel, titanium, brass) and compatible plastics. The abrasive media size and pressure are adjusted per material to achieve the right surface texture without damaging the part geometry.

Pre-Treatment for Anodizing

Bead blasting is the standard pre-treatment before anodizing on premium parts. The uniform matte base ensures the anodize coat absorbs evenly, producing consistent color depth across the entire surface. Parts anodized without prior bead blasting often show "witness marks" where machining direction changes are visible through the anodize coat.

Dimensional Impact

Bead blasting removes a small, consistent amount of material from the surface — typically less than 0.05mm. For most applications this is negligible, but for very tight-tolerance features (±0.05mm or tighter), the dimensional impact should be considered and critical dimensions should be masked or post-machined after blasting.

Bead blasting is one of the most cost-effective ways to transform a functional prototype into a presentation-quality part. The uniform matte surface eliminates the "machined look" and gives aluminum, steel, and titanium parts a professional finish that clients and investors respond to immediately.

Section 06

Brushing, Black Oxide & Powder Coat — Specialized Finishes

Beyond the core anodizing and blasting options, JUSTWAY offers three additional specialized surface treatments — each serving a distinct functional or aesthetic requirement that the primary finishes don't cover.

Black powder coated CNC machined parts brushed and black oxide finish
▲ Black powder coated CNC parts — chip-resistant, durable matte black finish for industrial applications
Brushing — Linear Aesthetic Texture

Brushing uses abrasive belts to draw consistent linear texture marks (grain lines) across the metal surface. Unlike bead blasting which creates an omnidirectional matte texture, brushing creates a directional, grain-like appearance that catches light differently depending on viewing angle. It's primarily an aesthetic treatment — the brushed aluminum look of premium laptops, professional audio equipment, and high-end kitchen hardware. Available on metals, applied before any coating operations.

Black Oxide — Low-Profile Corrosion Protection for Steel

Black oxide is a conversion coating applied to stainless steel and mild steel. Unlike electroplating or anodizing, black oxide converts the outermost layer of the steel surface into magnetite (Fe₃O₄) — a black iron oxide compound that provides mild corrosion resistance and significantly reduces light reflection. The critical advantage: black oxide adds essentially zero dimensional buildup (less than 0.0001mm), making it compatible with extremely tight-tolerance steel parts. Common in tools, fixtures, industrial hardware, optical instruments, and military components where matte black appearance and dimensional integrity are both required.

Powder Coating (Matt) — Durable Colored Protection

Powder coating applies electrostatically-charged dry powder to the part surface, then cures it in an oven at 180–200°C. The result is a thick (60–100 microns), extremely hard, impact-resistant coating that provides far superior durability compared to liquid spray paint. Available in a wide range of colors, powder coat is the finishing choice for CNC metal parts that will be subjected to regular handling, abrasion, or outdoor exposure. JUSTWAY offers powder coat in matt finish, compatible with all metals.


Section 07

Spray Painting — PANTONE Color Matching

For CNC parts requiring specific colors — whether for brand identity, functional color-coding, or presentation prototyping — spray painting delivers PANTONE-accurate results with your choice of matte or high-gloss finish. JUSTWAY's spray painting service uses industrial spray guns that atomize paint into fine, uniform droplets, producing smooth coats without brush marks or roller texture.

Two variants are available: matte paint and high-gloss paint. Both are applicable to aluminum, titanium, and compatible plastics. The spray painting workflow at JUSTWAY uses both matte and high-gloss PANTONE reference charts, enabling color-matched output for product teams with specific brand color requirements.

Industrial spray painting metal parts blue color coating
▲ Industrial spray painting — PANTONE-accurate color coating on CNC machined metal parts

Matte Spray Paint

Produces a flat, non-reflective finish that conceals minor surface irregularities and gives a professional, understated appearance. Preferred for industrial equipment, medical devices, and products where glare reduction is important.

High Gloss Spray Paint

Produces a mirror-like reflective finish with deep color saturation. Used for consumer products, luxury hardware, automotive trim, and presentation models where visual impact is the primary objective. Requires a well-prepared smooth base surface for best results.

PANTONE Color Matching

JUSTWAY maintains physical PANTONE matte and high-gloss reference libraries. Specify your PANTONE code in the order notes and the finishing team matches it directly. Critical for brand-color-compliant product prototypes and production cosmetic parts.

Coating thickness note: Spray paint adds 20–80 microns per coat to the part surface. For tight-tolerance features (holes, bores, mating faces), mask these areas before painting or specify post-paint machining. JUSTWAY's DFM review will flag tolerance-critical surfaces when spray painting is selected.


Section 08

Full Surface Finish Comparison — Material by Material

Choosing the right finish starts with knowing what's compatible with your material. Here's JUSTWAY's complete CNC surface finish lineup with material compatibility, dimensional impact, and ideal use cases:

Finish Materials Ra / Buildup Key Benefit Tier
Standard (As-Milled) All metals, plastics Ra 3.2 μm / None Fastest turnaround, zero dimensional change Default
Smooth Machining All metals, plastics Ra 1.6 μm / None Improved aesthetics + sealing surfaces Standard+
Bead Blast Metals, plastics Matte / <0.05mm Uniform matte texture, removes marks Standard+
Brushing Metals Linear grain / Minimal Premium directional aesthetic Aesthetic
Anodizing Aluminum only 5–25 μm buildup Hard oxide, corrosion resistance, color Protective
Bead Blast + Anodized Aluminum only Matte + 5–25 μm Premium matte color, aerospace standard Premium
Conductive Oxidation Aluminum only 0.01–0.15 μm Corrosion protection + electrical conductivity Specialty
Black Oxide Steel, stainless steel <0.0001mm Matte black, minimal dimensional change Protective
Spray Paint (Matte) Al, Ti, plastics 20–80 μm per coat PANTONE color, matte finish Color
Spray Paint (High Gloss) Al, Ti, plastics 20–80 μm per coat PANTONE color, mirror-like gloss Color
Powder Coat (Matt) All metals 60–100 μm Maximum durability, chip-resistant Durable

50+ finishes available: The table above covers JUSTWAY's standard online catalog. With over 50 surface finishes available across all manufacturing processes (CNC, sheet metal, 3D printing, injection molding), JUSTWAY can accommodate specialty requirements — electroplating, passivation, Alodine, and more — by selecting "custom" in the finish menu during quoting.


Section 09

Real-World Applications — Which Finish for Which Industry

Surface finish selection is ultimately an engineering decision driven by application requirements. Here's how the most demanding industries map their requirements to JUSTWAY's CNC finishing options:

Aerospace & Aviation

Structural brackets, avionics housings, and mounting hardware typically require bead blast + anodized color on aluminum, or black oxide on steel. Electrically conductive oxidation is specified wherever EMI shielding and electrical grounding are both required. JUSTWAY holds ISO 9001 and AS 9100 certifications — the quality standards aerospace procurement teams require before approving a supplier.

Automotive

Under-hood components face thermal cycling, chemical exposure (oils, coolants, brake fluid), and vibration. Powder coat provides the durability for exterior and underbody structural parts. Anodizing handles aluminum engine components. Black oxide is standard for precision steel fasteners, pins, and locating features where dimensional change from coating must be near-zero.

Consumer Electronics

The premium electronics aesthetic — think high-end laptops, audio equipment, smart home devices — is almost universally bead blast + anodized black or silver on aluminum. Brushed aluminum is the alternative when a directional grain texture is preferred. For product teams presenting to investors or at trade shows, high-gloss spray paint in brand PANTONE colors creates an immediate "production-quality" impression even on prototype parts.

Medical Devices

Medical device components require surface finishes that withstand sterilization (autoclaving, EtO, chemical disinfectants) without degrading. Smooth machining of stainless steel 316L to Ra 0.8 μm or below is standard for surfaces in contact with bodily fluids or pharmaceutical products. Passivation (removing free iron from stainless steel surfaces) is a common additional step — available through JUSTWAY's custom finish request process. JUSTWAY holds ISO 13485 certification.

Robotics & Automation

Robot end-effectors, motor mounts, and structural frames need wear-resistant surfaces that don't add significant weight. Hard anodizing on aluminum provides an exceptionally hard surface (up to Rockwell 70C) — harder than mild steel — at effectively zero weight penalty. For sliding contact surfaces like linear rails and guidance channels, smooth machining to Ra 0.8 μm or below minimizes friction and extends service life.

Industrial Machinery

Heavy industrial components — machine tool housings, hydraulic manifolds, fixture plates — prioritize corrosion protection and dimensional stability over aesthetics. Powder coat is the workhorse here: thick, chip-resistant, available in any RAL or PANTONE color, and compatible with all metals. Black oxide handles precision steel components where coating buildup would affect press fits or sliding clearances.

CNC precision drilling machining aerospace automotive industry applications
▲ Precision CNC machining in action — aerospace and industrial surface-critical applications

Section 10

Design Guidelines for Surface Finish Compatibility

The most common surface finishing mistakes happen in CAD, not in the finishing process itself. Here are the critical design rules for specifying finishes on CNC parts correctly:

Account for Coating Buildup on Tight-Tolerance Features

Anodizing adds 5–25 microns per surface. Powder coat adds 60–100 microns. Spray paint adds 20–80 microns. If a hole diameter, bore, or shaft OD has a tolerance tighter than the coating buildup, machine those features to the pre-coat dimension and specify them for masking, or plan for post-coat machining. JUSTWAY's DFM review catches these conflicts automatically.

Specify Ra on Your Technical Drawing

Default CNC output is Ra 3.2 μm. If you need Ra 1.6 μm or below on specific surfaces, mark it on the drawing with a surface finish symbol and value. Don't assume smooth machining is applied to the whole part — it adds cost and time, and JUSTWAY will apply it only where specified unless you request a blanket finish specification.

Design for Masking Access

If specific features (press-fit holes, threaded bores, sealing faces) must be kept bare metal while the rest of the part is coated, design those features to be accessible for masking — no deep recesses, no obstructed bores. Features that can't be masked can't be reliably kept coating-free. Note masking requirements in your order and on the drawing.

Avoid Mixed Materials When Specifying Anodizing

Anodizing requires an electrically conductive path. If your assembly includes inserts, fasteners, or bonded components of different materials, ensure the aluminum body is isolated from dissimilar metals before anodizing — galvanic reactions between aluminum and steel in an anodizing bath can produce poor or uneven coating. Design anodized parts as single-material aluminum components wherever possible.

Sharp Corners Trap Coating — Radius Them

Sharp internal corners trap powder coat and spray paint, creating drips and uneven buildup at corners. Design internal radii of at least 0.5mm on all features that will receive a liquid or powder coating. This is also good practice for structural reasons — sharp corners concentrate stress regardless of finish.

Use DFM feedback before ordering: JUSTWAY's automated DFM analysis reviews your uploaded file for finish-related design issues before production — flagging tight tolerances that conflict with specified coatings, features that can't be properly masked, and material/finish incompatibilities. Fix these before placing the order; changes after machining has started are expensive.


Section 11

How to Order CNC Parts with Surface Finishing from JUSTWAY

JUSTWAY's online platform makes specifying and ordering surface-finished CNC parts as straightforward as uploading a file. Here's the complete workflow:

1

Prepare Your CAD File

Export as STEP, STP, IGES, STL, or your native CAD format. If tight tolerances or specific Ra values are required on particular surfaces, attach a technical drawing (PDF) with surface finish symbols and tolerance callouts. JUSTWAY accepts all major formats and reviews technical drawings alongside 3D files.

2

Upload and Get an Instant Quote

Head to JUSTWAY.com's CNC machining quote page. Upload your file and receive real-time pricing. The platform supports 3-axis CNC milling and 5-axis indexed milling across 30+ metals and plastics, with lead times from 3 days. Quotes for complex configurations complete within 2–4 hours during business hours.

3

Select Material and Surface Finish

The quoting interface shows all surface finishes compatible with your chosen material. Select from: Standard (as-milled), Smooth Machining, Bead Blast, Brushing, Anodizing, Bead Blast + Anodized Color, Conductive Oxidation, Black Oxide, Spray Paint (Matte/Gloss), or Powder Coat. For color finishes, specify your PANTONE code or RAL number in the notes field.

4

Review DFM Feedback

JUSTWAY's Design for Manufacturability analysis reviews your part geometry for machinability issues and finish compatibility conflicts before production begins. This step identifies problems — tight-tolerance features that conflict with coating buildup, features that can't be masked, undercuts that affect finish access — before any material is cut. Resolve flagged issues in CAD and re-upload.

5

Specify Appearance Grade

JUSTWAY offers two appearance grades. Standard grade allows normal processing traces and minor finishing marks. Premium grade requires a clean, smooth surface with no obvious flaws — photos are sent for confirmation before shipment. For presentation prototypes and client-facing parts, specify premium grade to ensure the highest cosmetic standard.

6

Confirm, Track and Receive

JUSTWAY accepts PayPal, Visa, Mastercard, AMEX, and Discover. Real-time production tracking shows progress through machining, finishing, QC inspection, and shipping. Parts ship globally to 150+ countries. If any part doesn't meet specification, the free reprint guarantee covers a reorder or full refund — no questions asked.

Tolerances followed: JUSTWAY follows ISO 2768/GB/T1804 standard for general CNC machining tolerances — ±0.1mm for metals up to 6mm, ±0.2mm for 6–30mm. If your drawing has tighter requirements on specific dimensions, flag them at quote time with your technical drawing attached so the engineering team knows exactly what matters before cutting begins.


Final Thoughts

Surface Finishing Is Where Engineering Meets Craft

A CNC-machined part without a specified finish is an unfinished product. The finish you choose determines whether your part lasts one year or twenty, whether it passes a client presentation or looks like a prototype, whether it survives a corrosive environment or corrodes in six months. Surface finishing isn't cosmetic — it's engineering.

JUSTWAY's CNC machining service — with 10+ online surface finish options, material-aware quoting, automated DFM review, and professional finishing teams in Hangzhou, Shenzhen, and Shanghai — makes specifying the right finish as straightforward as selecting from a dropdown. The platform scales from a single prototype with bead blast + anodized black to production runs of powder-coated structural assemblies, all with the same instant quoting workflow and free-reprint guarantee.

Whether you need a smooth-machined stainless steel sealing surface for a medical device, a bead-blasted anodized aluminum enclosure for a consumer product launch, or a black oxide steel fixture for a manufacturing line — upload your file and get a quote in minutes.

Ready to Finish Your CNC Parts?

Upload your design file and get an instant quote for CNC machining with 10+ professional surface finishes. Lead times from 3 days. Tolerances to ±0.005mm. Free reprint guarantee.

Comments

Popular posts from this blog

Solar Tracking System

Dual-Axis Solar Tracking System | Arduino SimpleCircuits Arduino Solar DIY Renewable Energy Project Dual-Axis Solar Tracking System Build a high-performance solar tracker that follows the sun in real-time. Four LDR sensors, an Arduino UNO, and two servo motors — boosting energy capture by up to 40% versus fixed mounts. 40% More Efficient 4 LDR Sensors 2 Servo Axes <300mA Power Draw Finished Build System Overview How the System Works The tracker reads the sky through four LDR sensors placed around the panel, computes intensity deltas, and drives two SG90 servos in a real-time closed loop — keeping the panel perpendicular to sunlight from sunrise to sunset. ...

Arduino Code Car Parking System

 // Created by Simple Circuits  #include <Wire.h>  #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,16,2);    #include <Servo.h>  Servo myservo; int IR1 = 2; int IR2 = 3; int Slot = 4;           //Total number of parking Slots int flag1 = 0; int flag2 = 0; void setup() {   Serial.begin(9600);      lcd.init(); //initialize the lcd     lcd.backlight(); //open the backlight     pinMode(IR1, INPUT); pinMode(IR2, INPUT);    myservo.attach(4); myservo.write(100); lcd.setCursor (0,0); lcd.print("     ARDUINO    "); lcd.setCursor (0,1); lcd.print(" PARKING SYSTEM "); delay (2000); lcd.clear();   } void loop(){  if(digitalRead (IR1) == LOW && flag1==0){ if(Slot>0){flag1=1; if(flag2==0){myservo.write(0); Slot = Slot-1;} }else{ lcd.setCursor (0,0); lcd.print("    SORRY :(    ");   lc...

Arduino Code

 //define Pins #include <Servo.h> Servo servo; int trigPin = 11; int echoPin = 12; // defines variables long duration; int distance; void setup()  {   servo.attach(13);   servo.write(180);  delay(2000);    // Sets the trigPin as an Output pinMode(trigPin, OUTPUT); // Sets the echoPin as an Input  pinMode(echoPin, INPUT); } void loop()  { // Clears the trigPin digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); // Calculating the distance distance= duration*0.034/2; // Prints the distance on the Serial Monitor Serial.print("Distance: "); Serial.println(distance); if ( distance <= 25   ) // Change Distance according to Ultrasonic Sensor Placement  { servo.write(180); delay(3000); ...