ODROID C2 analogue GPIO inputs

Moderator: leecollings

Post Reply
lucdesmedt
Posts: 4
Joined: Monday 23 December 2019 21:50
Target OS: Linux
Domoticz version: 4.10717
Location: Brussels
Contact:

ODROID C2 analogue GPIO inputs

Post by lucdesmedt »

Hello,

I recently installed Domoticz on my Odroid C2. Works fine, digital GPIO pins are easily accessable.

However, the Odroid C2 has 2 analogue GPIO input pins. Can somebody help me how to integrate the values of these analogue inputs into Domoticz ?
lucdesmedt
Posts: 4
Joined: Monday 23 December 2019 21:50
Target OS: Linux
Domoticz version: 4.10717
Location: Brussels
Contact:

Re: ODROID C2 analogue GPIO inputs

Post by lucdesmedt »

I found the answer myself. Create a virtual sensor (millivolt) as unit and write a lua script

commandArray = {}

file = io.open("/sys/class/saradc/ch0", "r")
io.input(file)
value = math.floor(io.read()*1700/1024)
io.close(file)

commandArray['UpdateDevice'] = '55|0|'..value..''

return commandArray
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest