Softata: Grove Actuator Class API
January 15, 2024 21:53
David Jones MVP
softata
rpipico
firmata
arduino
csharp
bme280
grove
pico
sdk-for-c-arduino
tcpip
15 Jan 2024 21:53:33
David Jones MVP
softata rpipico firmata arduino csharp bme280 grove pico sdk-for-c-arduino tcpip
softata rpipico firmata arduino csharp bme280 grove pico sdk-for-c-arduino tcpip
Arduino and mirroring C# Actuator class commands. Specifically implemented for a Servo.
Actuators Class API in Softata (Arduino)
enum actuators {SERVO}
- String GetListof()
- GetIndexOf(String actuatorName)
- When an Actuator is instantiated it is added t0 a linked list.
- This gets its index in the list using the device name.
- Assumes only one per actuator type.
- String GetPins()
- bool Setup()
- bool Setup(byte * settings, byte numSettings) //2do
- bool Write(double value, int index) //2Do
- bool Write(int value, int index)
Actuators Class API in SoftataLib (C#)
- string[] GetActuators()
- Get names of actuators implemented (SERVO is only one thus far)
- linkedListNo = SetupDefault(ActuatorDevice deviceType)
- Use defaults D16 and 540, 2400 for SERVO
- linkedListNo = Setup(ActuatorDevice deviceType, byte pinNumber)
- linkedListNo = Setup(ActuatorDevice deviceType, byte pinNumber, byte min=0, byte max=0) //2Do
- min and max (Servo):
- Suggested and values are 544 and 2400 respectively (as used in default setup)
- Are the minimum and maximum pulse widths in micrososeconds sent to Servo.
- minimum = 0 degrees
- maximum = sets max degrees, 2400 equates to 180 degrees.
- Nb: Was found that without setting these, maximum swing was 90 degrees.
- Note there is also a period setting of 20000 microseconds, embedded in the Arduino code.
- min and max (Servo):
- ActuatorWrite(byte linkedListNo, byte value)
- value for Servo, 0 to 180 degrees
- ActuatorWrite(byte linkedListNo, double value) //2Do
Actuators
- Servo
- Micro Servo 90 SG90
- [Data sheet link](http://www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/stores/sg90_datasheet.pdf}
- Nb Datasheet says 1-2ms for pulse width, was found 540 uS to 2400 uS were correct
- Connections to Grove cable
- Grove Black (Gnd) to Servo Dark Brown
- Grove Red (Vcc) to Servo Red
- Grove Yellow (PWM Signal) to Servo Yellow
- Arduino Library, direct install, search for Servo
Topic | Subtopic | |
This Category Links | ||
Category: | Softata Index: | Softata |
Next: > | Softata | Console App - Serial-GPS |
< Prev: | Softata | Arduino Issues |