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)

 TopicSubtopic
   
 This Category Links 
Category:Softata Index:Softata
  Next: > Softata
<  Prev:   Softata