-
Notifications
You must be signed in to change notification settings - Fork 234
LINEAR POT SENSOR
Jaume Olivé Petrus edited this page Aug 29, 2017
·
12 revisions
| What | Comments | |
|---|---|---|
| Identifier | LINEAR_POT | .
-- Attach a led at GPIO32
led = pwm.attach(pio.GPIO32, 1000, 0)
led:start()
-- Attach a potentiometer connected to an external ADC (ADS1115) / cannel 0
s = sensor.attach("LINEAR_POT", adc.ADS1115, 0)
-- Read potentiometer value every 10 msecs
thread.start(function()
while true do
tmr.delayms(10)
led:setfreq(1000)
led:setduty(s:read("val"))
end
end)