summaryrefslogtreecommitdiff
path: root/julia-arduino-master/examples/Servomotor/servo-pot.jl
blob: 7624a261132195f46479982d65646b9672100c1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using SerialPorts
using ArduinoTools

ser = connectBoard(115200)
ServoAttach(ser,1)
for i = 1:500
  p = analogRead(ser,2)
  p = p*(180/1023)
  q = round(Int,floor(p))
  ServoMove(ser,1,q)
  sleep(0.5)
end
ServoDetach(ser,1)
close(ser)