- Netduino Forums
- → Viewing Profile: Posts: MrGringoPy
Community Stats
- Group Members
- Active Posts 8
- Profile Views 6184
- Member Title New Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
Posts I've Made
In Topic: 5v Power Supply?
22 July 2013 - 10:55 PM
In Topic: Using PWM with NetduinoPlus2
08 July 2013 - 09:40 PM
Hi
Now I have a new question.
Servo works well with your code Tim, if I conect Yellow to I/O pin 5 and Black to NP2 Ground and Red to Np2 +5v.
But if I conect to external power the servo, it does not work. Red to external + 6v and Black to external " - ".
I have also tried, Red external +6v and Black external " - " plus I have linked the external " - " to the NP2 Ground so as to use a common " - ". Still does not work.
What could be the problem.?
My servo is a HS-5645MG .
In Topic: Using PWM with NetduinoPlus2
08 July 2013 - 12:42 PM
Thanks Tim C for the servo code. I have hundreds of hours tring to get my servo to work. This is the first code that I found on the internet that works on the NP2.
You made my day.
Thanks.
In Topic: Netduino plus 2 driving Servo (Futuba S3003)
08 July 2013 - 12:07 PM
Thanks for the code. I am new at this and have been tring for more than a week now to get my servo to work on my NP2. I do know C# and work in VB. This code I will try in C#
What PIN do I plug the servo into?
Thanks again.
In Topic: HELP with servo on NP2
05 July 2013 - 03:28 PM
Ok.... I found this code and I set it up as they said. Now this happens ALL the time. I past it, and it has a load of errors. It beats me how it can work for some ells and not for me.
As you said Heroduino, writing it in code is a lot easier to understand. So please if can please fix the code for me.
Here are the errors and the code.
Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. Servo_AP.vb 41 25 Servo test 12 Warning 2 Using DirectCast operator to cast a value-type to the same type is obsolete. Servo_AP.vb 41 44 Servo test 12 Error 3 The targeted platform does not support latebinding. Servo test 12Servo_AP.vb 43 13 Servo test 12 Error 4 'SetDutyCycle' is not a member of 'Microsoft.SPOT.Hardware.PWM'. Servo test 12Servo_AP.vb 66 13 Servo test 12 Error 5 'SetPulse' is not a member of 'Microsoft.SPOT.Hardware.PWM'. Servo_AP.vb 87 17 Servo test 12
Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware Imports SecretLabs.NETMF.Hardware.Netduino Module Module1 Sub Main() Dim servo As New Servo_API.Servo(Pins.GPIO_PIN_D9) Dim i As Integer = 0 Do While True Do While i < 100 'Loop to fade from off to full on' servo.Degree = i 'wait for 15 milliseconds' Thread.Sleep(10) i = i + 1 Loop i = 100 Do While i > 0 'Loop to fade from full on to off' servo.Degree = i 'wait for 15 milliseconds' Thread.Sleep(10) i = i - 1 Loop Loop End Sub End Module
--------------------------------------------------------------------------------------------------------------------------
' ' * Servo NETMF Driver ' ' * Coded by Chris Seto August 2010 ' ' * <chris@chrisseto.com> ' ' * ' ' * Use this code for whatveer you want. Modify it, redistribute it, I don't care. ' * I do ask that you please keep this header intact, however. ' ' * If you modfy the driver, please include your contribution below: ' ' * ' ' * Chris Seto: Inital release (1.0) ' ' * Chris Seto: Netduino port (1.0 -> Netduino branch) ' ' * Chris Seto: bool pin state fix (1.1 -> Netduino branch) ' ' * Fileark: 2012-05-08 Converted to VB ( ' * ' ' * ' Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware Namespace Servo_API Public Class Servo Implements IDisposable ' PWM handle' Private servo As PWM ' Timings range' Private range As Long() = New Long(1) {} ' Set servo inversion' Public inverted As Boolean = False ' Create the PWM pin, set it low and configure timings' Public Sub New(ByVal pin As Cpu.Pin) ' Init the PWM pin' Dim servo = New PWM(DirectCast(pin, Cpu.Pin)) servo.SetDutyCycle(0) ' Typical settings' range(0) = 800 range(1) = 3200 End Sub Public Sub Dispose() Implements IDisposable.Dispose disengage() servo.Dispose() End Sub ' Allow the user to set cutom timings' Public Sub setRange(ByVal fullLeft As Long, ByVal fullRight As Long) range(1) = fullLeft range(0) = fullRight End Sub ' Disengage the servo. ' ' The servo motor will stop trying to maintain an angle' Public Sub disengage() servo.SetDutyCycle(0) End Sub ' Set the servo degree' Public WriteOnly Property Degree() As Double Set(ByVal value As Double) ' Range checks' If value > 180 Then value = 180 End If If value < 0 Then value = 0 End If ' Are we inverted?' If inverted Then value = 180 - value End If ' Set the pulse' servo.SetPulse(20000, CUInt(map(CLng(Math.Truncate(value)), 0, 180, range(0), range(1)))) End Set End Property ' Used internally to map a value of one scale to another' Private Function map(ByVal x As Long, ByVal in_min As Long, ByVal in_max As Long, ByVal out_min As Long, ByVal out_max As Long) As Long Return (x - in_min) * (out_max - out_min) (in_max - in_min) + out_min End Function End Class End Namespace
- Netduino Forums
- → Viewing Profile: Posts: MrGringoPy
- Privacy Policy