Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By mrburnette
#31075
After sending zero pwm data to the channels, sending multiple lines of pwo to get multiple pwm channels to work actually fails.
Only one pwm channel can function at any time.
If the multiple sends are set up in a program, the only way to get a single channel up and running again is via command line action.


Sounds to me that what you really need would be analogious to an Excel macro or a subroutine that could be stored into flash and called from the main program.

Ray
User avatar
By Roffey
#31080 Actually all I am saying is the following ....
Using the standard gpio example....
Pin 12 500 set pwm ..... fine .... pin 12 ouputs pwm
Now change the setting to say 800 ie Pin 12 800 ..... pwm output stops.

Change the pwm sub to include sending a 0 val pwo before a second pwo with the desired value.
This now works.

Change the sub in order to get two pwm outputs, on say 12 and 14 ..... doesn't work. Can only get pwm on one pin at a time.

Just as a second note .... the servo appears to produce 0.5mS to 2.5mS pulses in the range 0 - 180. should be 1.0mS to 2.0mS?

Relating to the pwm issue, I'll post up a simple program that stages through the issues I have. Hopefully today if time allows.

The whole point here is to be able to use my Android B4a remote control ( which I use to control mqtt stuff, milight udp etc) to send simple http commands to espbasic modules. Would make life simple for relay, pwm, or servo type control etc.
Sure, I can do it other ways, as I am, but the simplicity of this espbasic makes the attempt very appealing.
User avatar
By Roffey
#31101 Here's a simple test routine for the pwm issues I experience.
For visual I have leds on pins 12 and 14, as well as an analyser on them.

Print "Step 1 sends pwo 12 250"
Print "Step 2 sends pwo 12 750"
Print "Step 3 sends pwo 12 0 and pwo 12 250"
Print "Step 4 sends pwo 12 0 and pwo 12 750"
Print "Step 5 sends pwo 14 250"
Print "Step 6 sends pwo 14 0 and pwo 14 250"
Print "Step 7 sends pwo 14 0 and pwo 14 750"
Print "Step 8 sends pwo 12 0 and pwo 14 0"

Start up and I'm seeing some other previous Statpin etc being sent via the serial.
Into edit and load up this file.
Run this file.
Step1 ... pin 12 into pwm 250
Step2 ... pin 12 goes high
Step3 ... pwm of 250 on pin 12
Step4 ... pwm of 750 on pin 12
Step5 ... pin 14 goes low pin 12 high
Step6 ... no change
Step7 ... no change
Step8 ... ( just sends zero's pwm to both)
Step5 ... no change
Step6 ... pwm 250 on pin 14
Step7 ... pwm 750 on pin 14
Step8 ... (sends zero's to both)
Steps 1 2 3 4 5 6 and 7 now make no change, until use step 8
Then Steps 6 & 7 will function.


cls
button "Step1" [pwm1]
button "Step2" [pwm2]
button "Step3" [pwm3]
button "Step4" [pwm4]
button "Step5" [pwm5]
button "Step6" [pwm6]
button "Step7" [pwm7]
button "Step8" [pwm8]
button "Step9" [pwm9]
button "Exit " [TestExit]
Print "Step 1 sends pwo 12 250"
Print "Step 2 sends pwo 12 750"
Print "Step 3 sends pwo 12 0 and pwo 12 250"
Print "Step 4 sends pwo 12 0 and pwo 12 750"
Print "Step 5 sends pwo 14 250"
Print "Step 6 sends pwo 14 0 and pwo 14 250"
Print "Step 7 sends pwo 14 0 and pwo 14 750"
Print "Step 8 sends pwo 12 0 and pwo 14 0"
wait
[pwm1]
pwo 12 250
wait
[pwm2]
pwo 12 750
wait
[pwm3]
pwo 12 0
pwo 12 250
wait
[pwm4]
pwo 12 0
pwo 12 750
wait
[pwm5]
pwo 14 250
wait
[pwm6]
pwo 14 0
pwo 14 250
wait
[pwm7]
pwo 14 0
pwo 14 750
wait
[pwm8]
pwo 12 0
pw0 14 0
wait
[pwm9]
wait
[TestExit]
end