Bunny_bt

cc-sensor_boilerplate

May 27th, 2022 (edited)
422
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI('ocs/apis/sensor')
  2. local mySensor = peripheral.find('sensor')
  3. local targets = mySensor.getTargets()
  4. local isReading = true
  5.  
  6. while isReading do
  7.     for k, v in pairs(targets) do
  8.         local obj = mySensor.getTargetDetails(k)
  9.         print(obj.Name)
  10.         if obj.name == '' then
  11.             break
  12.         end
  13.     end
  14.    
  15.     os.sleep(60)
  16. end
RAW Paste Data Copied