B4R Library rAdafruit_MCP3008

This is a wrapper for: https://github.com/adafruit/Adafruit_MCP3008

Example:
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private mcp As AdafruitMCP3008
   Private timer1 As Timer
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   Log(mcp.Initialize)
   timer1.Initialize("timer1_Tick", 1000)
   timer1.Enabled = True
End Sub

Sub Timer1_Tick
   For chan = 0 To 7
       Log("Channel: ", chan, ": ", mcp.ReadADC(chan))
   Next
End Sub
 

Attachments

  • rAdafruit_MCP3008.zip
    26.5 KB · Views: 444
Top