So I wrote a little bit of code with the intent of controlling the speed of a brushless motor using an ESC via the picaxe. Initially I tested it with a servo attached to check the output of the code worked. I am using a picaxe 28x1 and using the servo motor I had no problem
Using the programmed picaxe the esc will initialize correctly but after that I cant get the motor to run. If I reset the picaxe whilst the power is still on to the controller then at the servo 4,225 the motor will run up for the 4 second wait period at full speed. I then went and commented out the program and just added a servopos command operating in a loop to see if the motor would run but with no luck. I will attach the code below but would appreciate it if anyone could suggest something stupid I'm doing.
Code
init:
servo 4,225
wait 4
servo 4,75
;main:
;readadc A.0,w1 ;reads the hall effect adc
;readadc A.1,w2 ;reads the pot adc, was only for initial testing
;debug
;let w3=w1-130 ;takes the min input of hall effect switch and zeroes it
;let w4=w3*2 ;doubles the value returned due to low sensitivity
;let w5=w4+75 min 75 max 225 ;sets a min value of 75 for servo pos and limits the max value returned to 225
;servopos 4,w5
;goto main
main:
servopos 4,100
goto main
Thanks,
Paul
Using the programmed picaxe the esc will initialize correctly but after that I cant get the motor to run. If I reset the picaxe whilst the power is still on to the controller then at the servo 4,225 the motor will run up for the 4 second wait period at full speed. I then went and commented out the program and just added a servopos command operating in a loop to see if the motor would run but with no luck. I will attach the code below but would appreciate it if anyone could suggest something stupid I'm doing.
Code
init:
servo 4,225
wait 4
servo 4,75
;main:
;readadc A.0,w1 ;reads the hall effect adc
;readadc A.1,w2 ;reads the pot adc, was only for initial testing
;debug
;let w3=w1-130 ;takes the min input of hall effect switch and zeroes it
;let w4=w3*2 ;doubles the value returned due to low sensitivity
;let w5=w4+75 min 75 max 225 ;sets a min value of 75 for servo pos and limits the max value returned to 225
;servopos 4,w5
;goto main
main:
servopos 4,100
goto main
Thanks,
Paul