It is very tricky, depends on the details, and has likely changed after the AIA law changed the law wording. Most of the court cases relate to the pre-AIA law wording.
This is the kind of thing they put, with more details, on the patent bar exam. There are experimental use exceptions that can help you and commercial exploitation situations that can hurt you.
From the MPEP section on Public Use.
One Specific (pre-AIA) Case
Even If the Invention Is Hidden, Inventor Who Puts Machine or Article Embodying the Invention in Public View Is Barred from Obtaining a Patent as the Invention Is in Public Use
When the inventor or someone connected to the inventor puts the invention on display or sells it, there is a "public use" within the meaning of pre-AIA 35 U.S.C. 102(b) even though by its very nature an invention is completely hidden from view as part of a larger machine or article, if the invention is otherwise used in its natural and intended way and the larger machine or article is accessible to the public. In re Blaisdell, 242 F.2d 779, 783, 113 USPQ 289, 292 (CCPA 1957); Hall v. Macneale, 107 U.S. 90, 96-97 (1882); Ex parte Kuklo, 25 USPQ2d 1387, 1390 (Bd. Pat. App. & Inter. 1992) (Display of equipment including the structural features of the claimed invention to visitors of laboratory is public use even though public did not see inner workings of device. The person to whom the invention is publicly disclosed need not understand the significance and technical complexities of the invention.).