B4R Library rAdafruit_MCP3008

Similar threads

Wish MCP3008 ADC
B4R Question Adafruit MCP4725 how to use it on B4R ?
B4R Library rAdafruitNeoPixel
B4R Library rMCP2515
B4R Tutorial HC 05 Classic Bluetooth

Erel

Administrator
Staff member
Licensed User
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

Top