Softata: Analog Class API
January 12, 2024 21:53
David Jones MVP
softata
rpipico
firmata
arduino
csharp
bme280
grove
pico
sdk-for-c-arduino
tcpip
12 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
Generic and device specific Analog class methods. Specifically implemented for a Grove Light and Grove Sound Sensors as well as for a potentiometer.
Analog Class API in Softata (Arduino)
Like the digital functionality, there is basic Analog functionality embedded in the Arduino Softata app:
- AnalogRead(pinNumber)
- AnalogWrite(pinNumber, value) which is PWM
This is abstracted a bit in the C# code:
Analog Devices API in SoftataLib (C#)
enum device{potentiometer,light,sound}
- InitAnalogDevicePins(RPiPicoMode) //groveShield or defaultMode
- SetAnalogPin(device,pinNumber,maxValue=1024)
- int AnalogRead(int pinNumber) // Requires no setup
- Specific Analog device reads, returning a double as a percentage of the maximum value. The pins are assigned with SetAnalogPin. Only one instance of each device:
- double AnalogReadLightSensor()
- double AnalogReadSoundSensor()
- double AnalogReadPotentiometer()
PWM Class API
- SetPWM(int pinNumber, byte value)
Topic | Subtopic | |
This Category Links | ||
Category: | Softata Index: | Softata |
Next: > | Softata | Grove Sensor Class API |
< Prev: | Softata | Grove Class |