DC Motors with Blocklyprop
Carol Hazlett
Posts: 312
Is anybody coding DC Motors with Blocklyprop? I know the S3 uses DC motors but I am going to use the MSR1 for this project.
The PWM blocks under the Analog/Pulses menu look like they could be used but I can not find any info on them. What channel
are they referring to in the PWM set box? Is it motor A and motor B?
The PWM blocks under the Analog/Pulses menu look like they could be used but I can not find any info on them. What channel
are they referring to in the PWM set box? Is it motor A and motor B?
Comments
Does anybody have an idea how to change that? I have linked to a video of it careening around workroom and the code I am using.
A and B refer to the two counter/timers within a given COG. If you assign each one to a pin and set the duty cycle you can vary the speed of a motor or the brightness of a light source. However to effectively change the direction of a motor you would have to assign one input of the H-Bridge to high/low while using PWM on the other side. To reverse direction swap pins. I don't recall on the MSR1 board which pins were connected to the H-Bridge, but there should be 4 total...2 per motor.
So, for example where you have P24 low and P25 high, instead make P24 low and Send PWM to P25. Likewise on P26 send the B channel PWM and make P27 low. Let me know if this works for you.
I will have to look into this. I don't know what the PWM Frequency is. That may be the issue. I will do some testing tomorrow while I am in the office.