Guest User

SAMPLE CODE ON HOW TO USE MY PID LIBRARY

a guest
Sep 19th, 2023
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. os.loadAPI("lib/pidcontrollers.lua")
  2.  
  3. local P = 0.15
  4. local I = 0
  5. local D = 0.1
  6.  
  7. --used for integral clamping--
  8. local minimum_value = 0
  9. local maximum_value = 15
  10. --used for integral clamping--
  11.  
  12. local height_PID = pidcontrollers.PID_PWM_scalar(P, I, D, minimum_value ,maximum_value)
  13.  
  14. local height_error = current_height - target_height
  15.  
  16. while true do
  17. redstone_height = height_PID:run(height_error)
  18. end
Advertisement
Add Comment
Please, Sign In to add comment