I hope you can help me. There have been many changes since I last used the system.
I wanna make a system with two Servo motors.
Two years ago I made a sucessful test with a motorboard for big DC motors.
But I think the code changed.
Can I still use this command in 4.3?
you donāt need to use the L298 to drive a standard servo, the L298 is for DC motors. All you need is a standard PWM signal.
I donāt think that answers the question you asked, but it should reorient your thinking - you donāt need the L298 gadgeteer driver to get the servo to work.
But when I look at the documentation in 4.3⦠it looks way different.
⦠there is a new example in the legacy devices⦠but when I add those to the code:
using System.Threading;
using GHIElectronics.TinyCLR.Devices.Pwm;
using GHIElectronics.TinyCLR.Devices.Gpio;
using GHIElectronics.TinyCLR.Pins;
serious ?
TinyCLR is a nice very early alpha preview but far away from stable and far away from done and its missing to much features compared to your stable version of NETMF 4.3
based on the past TinyCLR releases it seems it could be feature equal to NETMF in one year from now on
Ok, I had a look at the documentation.
It totally exceeds my knowledge for PWM⦠but I give it a try.
Since I use a servo, I probably have to use this code:
public class Program
{
public static void Main()
{
PWM MyServo = new PWM(Cpu.PWMChannel.PWM_3, 2175, 175, PWM.ScaleFactor.Microseconds, false);
// 0 degrees. 20ms period and 1.25ms high pulse
MyServo.Duration = 1250;
MyServo.Period = 20000;
}
But how does my FEZ Reaper know, that the servo is connected on Socket_7 Pin_7 ?
Additional does my programm not know this ⦠command
And what is the difference to this kind of PWM use?
motordiver1.SetSpeed(MotorDriverL298.Motor.Motor1, 0.1);
Iām really thankful for all your help.
Itās very imprtant to me to get this servo running :3
Kind regards,
Evul
Edit:
Ok⦠I noticed that the documentation is not correct
Pin 7: Motor A Speed (PWM) ⦠Pin_7 is Motor B
The servo is doing something now⦠but heās more or less just running into a end position
Could this have to do something with the mentioned frequency?
Servos expect a pulse every 20ms to 30msstrong text
Gadgeteer is still an option for you if you really want - although the core netmf capabilities changed from where you came so you may still need to re-learn some of these things.
PWM pin mapping comes from the definition of the PWM object; the first parameter is Cpu.PWMChannel.PWM_3 which references a physical channel, and that is linked back to a specific pin. What that pinās capabilities are, are listed in the GHI provided helper GHI.Pins. Add that reference, and you can browse to see sockets and enclosed pin definitions. Iād suggest you actually use the GHI provided mapping, GHI.Pins.FEZRaptor.Socket18.Pwm7 looks to be the right place to connect it.
PWM reference not being found means your app needs another reference so that it can locate the correct calling procedure pattern - just add the Microsoft.SPOT.Hardware.PWM reference and youāre done.
youād need to dig into the driver code that the L298 motor module used, because itās abstracting the PWM component away from the user. I donāt think you need to worry about this, just move on and learn something new.
Uhh, Iām always up to learn something new.
But on the beginning I need a moment to understand such things.
Mostly I get stuck at the basics⦠for example this:
No idea what VS wants to tell me
Where do I find the GHI provided mapping?
Iām still working on it to understand how I adress that specific pin.
Documentation says this:
PWM MyServo = new PWM(Cpu.PWMChannel.PWM_3, 2175, 175, PWM.ScaleFactor.Microseconds, false);
But which pin am I adressing here?
In the end I need 3 PWM signals on 3 different pins.
How do I do that?
I really hope youāre not laughing too hard about my sillyness -.-
You added a USING statement, not a REFERENCE. You add references in the right hand panel in VS, in āreferencesā, right click and say Add Reference, select it from the list.
You are addressing the pin that is connected to PWM Channel 3. Itās completely up to the person who implemented the firmware to map that - so itās a GHI question that I canāt answer and doesnāt have a clear logical mapping. But if you add the GHI.PINS reference that I told you about, you get easy access to the correct PIN mapping without concern for the channels-to-pins (this is why GHI give you this!). There are three pins in Socket18 that have PWM capability.
yep, perfect. Sorry, I was looking at RAPTOR not REAPER
GHI.Pins.FEZReaper.Socket7.Pwm7
GHI.Pins.FEZReaper.Socket7.Pwm8
GHI.Pins.FEZReaper.Socket7.Pwm9
They are the references you need.