Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $regfile = "attiny13a.dat"
- $crystal = 9600000
- $hwstack = 10
- $swstack = 10
- $framesize = 28
- Config Adc = Single , Prescaler = Auto
- Config Servos = 1 , Servo1 = Portb.0 , Reload = 6
- Start Adc
- Enable Interrupts
- Config Portb.0 = Output
- Config Pinb.2 = Input
- Dim W As Word , Posa As Integer , Timetowait As Integer , Modee As Integer
- Posa = 44
- Servo(1) = Posa
- Modee = 0
- W = Getadc(1)
- If W < 20 Then
- Modee = 1
- End If
- Wait 2
- Do
- While Modee = 1
- W = Getadc(1) / 5
- W = W + 44
- If W < 44 Then
- W = 44
- End If
- If 208 < W Then
- W = 208
- endif
- Posa = W
- Servo(1) = Posa
- Waitms 10
- Wend
- While Modee = 0
- While Posa < 208
- W = Getadc(1)
- W = W * 13
- Posa = Posa + 1
- Servo(1) = Posa
- Waitms W
- Wend
- Wend
- Loop
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement