({{, (RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest])[device] 
returns the most recently collected default item from a device.}, {, (RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest])[device,n]
returns a list of the n most recently collected items.}, {, (RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest])[device,n,param]
returns the n most recently collected values of param.}, {, (RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest])[device,n,{(Subscript[param, 1]),(Subscript[param, 2]),…}]
returns a list of the most recently collected values of the (Subscript[param, i]).}})

OpenersNotesSection(Spacer1)Details

A device can be specified either by a (RefLink[DeviceObject, paclet:ref/DeviceObject]) or by a string representing a device class.

Only devices from which data is continuously collected support (RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest]).

(RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest]) is a non-blocking function. It uses data already collected from a device, and does not request additional data.

(RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest])[device,n] may return a list shorter than n elements if not enough pre-collected data is available.

(RefLink[DeviceReadLatest, paclet:ref/DeviceReadLatest])[device,n] returns data with the oldest first in the list.

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Continuously read random numbers from a demo device and plot the latest points dynamically:

dev = DeviceOpen["RandomSignalDemo"];

task=SessionSubmit[ScheduledTask[DeviceRead[dev],.2]];

Dynamic[ListLinePlot[DeviceReadLatest[dev,50]]]

Remove the task and close the device connection:

TaskRemove[task];

DeviceClose[dev]

OpenersExampleSection2(Spacer1)Applications  (1)

Configure a weather station device for reading the ambient illuminance:

dev=DeviceOpen["TinkerForgeWeatherStation"];
DeviceConfigure[dev,"AmbientLightBrickletUID"-> "ibF"];

Collect 100 samples of data while manually orienting the sensor toward and away from a light source:

task= SessionSubmit[ScheduledTask[DeviceRead[dev,"Illuminance"],0.1]];

ill=DeviceReadLatest[dev,100,"Illuminance"];

ListPlot[ill,Filling->Axis]

Stop the scheduled task and close the connection:

TaskRemove[task];
DeviceClose[dev];

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[DeviceReadBuffer, paclet:ref/DeviceReadBuffer])  ▪  (RefLink[DeviceRead, paclet:ref/DeviceRead])  ▪  (RefLink[DeviceStreams, paclet:ref/DeviceStreams])  ▪  (RefLink[DeviceExecuteAsynchronous, paclet:ref/DeviceExecuteAsynchronous])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Developing Device Drivers, paclet:tutorial/DevelopingDeviceDrivers])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Using Connected Devices, paclet:guide/UsingConnectedDevices])}, {▪(RefLinkPlain[Raspberry Pi, paclet:guide/RaspberryPi])}})}})